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 /save.go | |
| parent | 820fa4b7e71690accbd17063894032140bd9c4b6 (diff) | |
finally can fix the Load() and Save() names
Diffstat (limited to 'save.go')
| -rw-r--r-- | save.go | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -13,13 +13,13 @@ import ( var ErrProtoFilename error = fmt.Errorf("proto does not have Filename") -func ConfigSave(pb proto.Message) error { - return saveTEXT(pb, "") +func SavePB(pb proto.Message) error { + return Save(pb) } // writes the protobuf to disk // uses the already configured Filename -func SavePB(pb proto.Message) error { +func Save(pb proto.Message) error { fullname, err := GetFilename(pb) if err != nil { return err @@ -27,6 +27,12 @@ func SavePB(pb proto.Message) error { return SaveToFilename(pb, fullname) } +// special case. adds a header to the TEXT output +func SaveWithHeader(pb proto.Message, header string) error { + err := saveTEXT(pb, header) + return err +} + // writes the protobuf to disk (sets Filename if PB has 'Filename') func SaveToFilename(pb proto.Message, fullname string) error { basedir, _ := filepath.Split(fullname) @@ -67,11 +73,6 @@ func saveProto(pb proto.Message, fullname string) error { return configWrite(fullname, data) } -func SaveWithHeader(pb proto.Message, header string) error { - err := saveTEXT(pb, header) - return err -} - func saveTEXT(pb proto.Message, header string) error { // get pb.Filename if it is there in the .proto file fullname, err := GetFilename(pb) |
