summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorforge <[email protected]>2025-10-06 12:17:32 -0500
committerJeff Carr <[email protected]>2025-10-07 02:28:25 -0500
commit6bd10cf29ba546e80803874e0499d17aa2223330 (patch)
treec2ab43b5b07fe3fa9e9c313a5dc6f1895e98ccfa /config.go
parentcd5d073138cd52e21d3cdf751b39260ddedd4aba (diff)
wrong logic
Diffstat (limited to 'config.go')
-rw-r--r--config.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/config.go b/config.go
index ad0c4c1..3068869 100644
--- a/config.go
+++ b/config.go
@@ -23,7 +23,11 @@ func (all *Repos) ConfigSave(fname string) error {
log.Infof("ConfigSave() filename '%s' invalid\n", fname)
return log.Errorf("ConfigSave() filename '%s' invalid\n", fname)
}
+ return all.Save(fname)
+}
+// bypass name check "repos.pb"
+func (all *Repos) Save(fname string) error {
data, err := all.Marshal()
if err != nil {
log.Info("gitpb proto.Marshal() failed len", len(data), err)
@@ -90,6 +94,7 @@ func (all *Repos) ConfigLoad(cfgname string) error {
if data, err = loadFile(cfgname); err != nil {
// something went wrong loading the file
// all.sampleConfig() // causes nil panic
+ log.Info("Repos ConfigLoad() failed", cfgname, err)
return err
}
// this means the forge.pb file exists and was read
@@ -129,13 +134,11 @@ func (all *Repos) sampleConfig() {
func loadFile(fullname string) ([]byte, error) {
data, err := os.ReadFile(fullname)
if errors.Is(err, os.ErrNotExist) {
- // if file does not exist, just return nil. this
- // will cause ConfigLoad() to try the next config file like "forge.text"
- // because the user might want to edit the .config by hand
- return nil, nil
+ // the file does not exist
+ return nil, err
}
if err != nil {
- // log.Info("open config file :", err)
+ log.Info(fullname, "permission error? error =", err)
return nil, err
}
return data, nil