From b2887028424d7034dd46370be0f60d5e1fa4a13d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 17 Oct 2025 03:42:03 -0500 Subject: really dumb --- load.go | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/load.go b/load.go index fc9a5a0..e1e95d6 100644 --- a/load.go +++ b/load.go @@ -36,30 +36,10 @@ func ConfigLoad(pb proto.Message, appname string, protoname string) error { var pbFilenameSupport bool var err error curfilename, err := GetFilename(pb) - if err != nil { - log.Info("This protobuf doesn't support pb.Filename") - // make note this protobuf doesn't support Filenames - } else { + if err == nil { pbFilenameSupport = true - } - // panic(curfilename) - - // potential syntax with this GO library is starting to look like: - // - // if errors.Is(err, config.ErrEmpty) - // - // if errors.Is(err, config.VersionMismatch) - // - // 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 - if err := missingConfig(fullname); err != nil { - if errors.Is(err, os.ErrNotExist) { - return os.ErrNotExist - } - if errors.Is(err, ErrEmpty) { - return ErrEmpty - } - return err + } else { + // this .proto doesn't have the Filename variable/message } if err = loadTEXT(pb, fullname); err == nil { @@ -322,6 +302,7 @@ func loadJSON(pb proto.Message, fullname string) error { return nil } +/* left this here to remind myself just how dumb I can be // dumb but simple to read logic func missingConfig(fullname string) error { data1, err1 := os.ReadFile(fullname) @@ -341,6 +322,7 @@ func missingConfig(fullname string) error { } return nil } +*/ func loadFile(fullname string) ([]byte, error) { data, err := os.ReadFile(fullname) -- cgit v1.2.3