diff options
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) |
