diff options
| author | Jeff Carr <[email protected]> | 2025-10-22 09:19:26 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-22 09:19:26 -0500 |
| commit | 23b2d19bc03b4db253b15cc6fef7176ab31d4f18 (patch) | |
| tree | 275cb2d3fc92cb5af997582c715f4619eb1d68d2 /loadByAppname.go | |
| parent | 820fa4b7e71690accbd17063894032140bd9c4b6 (diff) | |
finally can fix the Load() and Save() names
Diffstat (limited to 'loadByAppname.go')
| -rw-r--r-- | loadByAppname.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/loadByAppname.go b/loadByAppname.go deleted file mode 100644 index 40ae9a4..0000000 --- a/loadByAppname.go +++ /dev/null @@ -1,51 +0,0 @@ -package config - -import ( - "errors" - "os" - - "go.wit.com/log" - "google.golang.org/protobuf/proto" -) - -// loads foo.proto from ~/.cache/<appname>/foo.pb -func LoadAppnameCache(pb proto.Message, appname string) error { - protoname, err := GetProtobufName(pb) // defined in the foo.proto file - if err != nil { - return err - } - - // Get ~/.cache/appname/protoname.text - fullname := makeCacheFilename(appname, protoname) - - // get the current filename in the protobuf file - curfilename, err := GetFilename(pb) - if err != nil { - return err - } - if curfilename == "" { - // log.Printf("ConfigLoad() read in %s\n", fullname) - } - - if !Exists(fullname) { - SetFilename(pb, fullname) - return os.ErrNotExist - } - - err = loadPB(pb, fullname) - if err != nil { - return ErrMarshal - } - - // If the cache file is new or has moved, this updates it to correct filename - // (the filename is what is used by pb.Save() - if curfilename != fullname { - _, err := SetFilename(pb, fullname) - if err != nil { - log.Info("FILENAME COULD NOT BE SET old=", curfilename) - log.Info("FILENAME COULD NOT BE SET new=", fullname) - return errors.Join(err, errors.New("something is wrong in lib/config")) - } - } - return nil -} |
