diff options
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |
