diff options
| author | Jeff Carr <[email protected]> | 2025-10-17 03:42:03 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-17 03:42:03 -0500 |
| commit | b2887028424d7034dd46370be0f60d5e1fa4a13d (patch) | |
| tree | d456fa9b11930c0120f38d44cc7b7af94f076743 /load.go | |
| parent | 5579498720c5c1e0cdf31f97f7ad31dfe9dbf0aa (diff) | |
really dumbv0.0.27
Diffstat (limited to 'load.go')
| -rw-r--r-- | load.go | 28 |
1 files changed, 5 insertions, 23 deletions
@@ -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) |
