diff options
| -rw-r--r-- | generateHeader.go | 22 | ||||
| -rw-r--r-- | protoParse.go | 3 |
2 files changed, 15 insertions, 10 deletions
diff --git a/generateHeader.go b/generateHeader.go index a36c1e1..78fb359 100644 --- a/generateHeader.go +++ b/generateHeader.go @@ -8,31 +8,33 @@ import ( "io" "os" + "go.wit.com/lib/gui/prep" "go.wit.com/log" ) func pbHeaderComment(w io.Writer) { // technically this should be the first line and in this exact format: fmt.Fprintln(w, "// Code modified by go.wit.com/apps/autogenpb DO NOT EDIT.") + fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest") fmt.Fprintln(w, "//") fmt.Fprintln(w, "// user defined Mutex locks were auto added") fmt.Fprintln(w, "//") - fmt.Fprintln(w, "// autogenpb version & build time:", VERSION, BUILDTIME) - fmt.Fprintln(w, "// autogenpb auto generates Sort(), Unique() and Marshal() functions") - fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest") + fmt.Fprintln(w, "// This file was autogenerated with autogenpb:") + fmt.Fprintln(w, "// ", prep.StandardVersion(ARGNAME, VERSION, BUILDTIME)) + fmt.Fprintln(w, "// Theese sort.pb.go and marshal.pb.go files are autogenerated") + fmt.Fprintln(w, "// The autogenpb sources have example .proto files with instructions") fmt.Fprintln(w, "") } func headerComment(w io.Writer) { // technically this should be the first line and in this exact format: fmt.Fprintln(w, "// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.") - fmt.Fprintln(w, "// This file was autogenerated with autogenpb", VERSION, BUILDTIME) fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest") fmt.Fprintln(w, "//") - fmt.Fprintln(w, "// define which structs (messages) you want to use in the .proto file") - fmt.Fprintln(w, "// Then sort.pb.go and marshal.pb.go files are autogenerated") - fmt.Fprintln(w, "//") - fmt.Fprintln(w, "// autogenpb uses it and has an example .proto file with instructions") + fmt.Fprintln(w, "// This file was autogenerated with autogenpb:") + fmt.Fprintln(w, "// ", prep.StandardVersion(ARGNAME, VERSION, BUILDTIME)) + fmt.Fprintln(w, "// Theese sort.pb.go and marshal.pb.go files are autogenerated") + fmt.Fprintln(w, "// The autogenpb sources have example .proto files with instructions") fmt.Fprintln(w, "//") fmt.Fprintln(w, "") } @@ -83,11 +85,11 @@ func (pb *File) addNewFunc(w io.Writer) { if pb.DoSave { fmt.Fprintln(w, "") fmt.Fprintln(w, "func (pb *"+STRUCT+") Save() error {") - fmt.Fprintln(w, " return config.SavePB(pb, pb.Filename)") + fmt.Fprintln(w, " return config.SavePB(pb)") fmt.Fprintln(w, "}") fmt.Fprintln(w, "") fmt.Fprintln(w, "func (pb *"+STRUCT+") Load() error {") - fmt.Fprintln(w, " return config.Load(pb)") + fmt.Fprintln(w, " return config.LoadPB(pb)") fmt.Fprintln(w, "}") } } diff --git a/protoParse.go b/protoParse.go index 6ecaa9d..03673b6 100644 --- a/protoParse.go +++ b/protoParse.go @@ -205,6 +205,9 @@ func (pf *File) parseForMessage(line string) *MsgName { if strings.Contains(line, "`autogenpb:marshal`") { msg.DoMarshal = true } + if strings.Contains(line, "`autogenpb:save") { + pf.DoSave = true + } if strings.Contains(line, "`autogenpb:http") { log.Info("got autogenpb:http") pf.DoHTTP = true |
