summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--load.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/load.go b/load.go
index 27b0396..caafcde 100644
--- a/load.go
+++ b/load.go
@@ -38,6 +38,7 @@ func ConfigLoad(pb proto.Message, argname string, protoname string) error {
}
fullname = filepath.Join(homeDir, ".config", argname, protoname+".text")
+ SetFilename(pb, fullname)
// if both don't exist or both are empty, return known errors
// these can be used to detect if the user is new to the application
@@ -205,12 +206,12 @@ func loadJSON(pb proto.Message, fullname string) error {
// dumb but simple to read logic
func missingConfig(fullname string) error {
data1, err1 := os.ReadFile(fullname)
- if ! errors.Is(err1, os.ErrNotExist) {
+ if !errors.Is(err1, os.ErrNotExist) {
return err1
}
data2, err2 := os.ReadFile(fullname + ".json")
- if ! errors.Is(err2, os.ErrNotExist) {
+ if !errors.Is(err2, os.ErrNotExist) {
return err2
}
if errors.Is(err1, os.ErrNotExist) && errors.Is(err2, os.ErrNotExist) {
@@ -232,7 +233,7 @@ func loadFile(fullname string) ([]byte, error) {
// log.Info("open config file :", err)
return nil, err
}
- if (len(data) == 0) {
+ if len(data) == 0 {
return data, ErrEmpty
}
return data, nil