summaryrefslogtreecommitdiff
path: root/load.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-03 07:58:13 -0500
committerJeff Carr <[email protected]>2025-10-03 07:58:13 -0500
commit96b5157afc629037f436e5a6d6ec40b4915ff64c (patch)
treecbf54a983efab17886363e6307108e7a58daa7f0 /load.go
parent9449405677c0a6f7b22c4aa9976ec3c718c5857a (diff)
set the filename herev0.0.7
Diffstat (limited to 'load.go')
-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