From 96b5157afc629037f436e5a6d6ec40b4915ff64c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 3 Oct 2025 07:58:13 -0500 Subject: set the filename here --- load.go | 7 ++++--- 1 file 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 -- cgit v1.2.3