diff options
| author | Jeff Carr <[email protected]> | 2025-10-06 23:10:00 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-06 23:10:00 -0500 |
| commit | b695089179b9003375a8c51ce45efeaffcc2e816 (patch) | |
| tree | 0e0dbdadae2efc4176719a8ad8ebe360b82d8b5e /load.go | |
| parent | 96b5157afc629037f436e5a6d6ec40b4915ff64c (diff) | |
awesome shortcuts
Diffstat (limited to 'load.go')
| -rw-r--r-- | load.go | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -70,6 +70,23 @@ func ConfigLoad(pb proto.Message, argname string, protoname string) error { return ErrMarshal } +func Load(pb proto.Message) error { + fullname, ok := GetFilename(pb) + if !ok { + return ErrProtoFilename + } + if strings.HasSuffix(fullname, ".text") { + return loadTEXT(pb, fullname) + } + if strings.HasSuffix(fullname, ".json") { + return loadJSON(pb, fullname) + } + if strings.HasSuffix(fullname, ".pb") { + return loadPB(pb, fullname) + } + return log.Errorf("unknown filetype %s", fullname) +} + func LoadFile(pb proto.Message, fullname string) error { if strings.HasSuffix(fullname, ".text") { return loadTEXT(pb, fullname) |
