diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -26,7 +26,7 @@ func main() { if !shell.Exists(argv.Proto) { log.Info("protobuf", argv.Proto, "is missing") - if ! argv.DryRun { + if !argv.DryRun { os.Exit(-1) } } @@ -54,6 +54,7 @@ func main() { sortmap := make(map[string]string) sortmap["package"] = packageName + sortmap["protobase"] = protobase sortmap["base"] = argv.LoBase sortmap["lock"] = sortmap["base"] + "slock" sortmap["Base"] = argv.UpBase @@ -79,13 +80,19 @@ func main() { iterSort(f, sortmap) iterAppend(f, sortmap) iterEnd(f, sortmap) + + // make the foo.marshal.pb.go file + marshal(sortmap) } func header(w io.Writer, names map[string]string) { fmt.Fprintln(w, "package "+names["package"]) fmt.Fprintln(w, "") - fmt.Fprintln(w, "// this is becoming a standard format") - fmt.Fprintln(w, "// todo: autogenerate this from the .proto file?") + fmt.Fprintln(w, "// this file was autogenerated with autogenpb") + fmt.Fprintln(w, "//") + fmt.Fprintln(w, "// you might be able to use it on simple, strictly defined protobuf files") + fmt.Fprintln(w, "//") + fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest") fmt.Fprintln(w, "") fmt.Fprintln(w, "import (") fmt.Fprintln(w, " \"fmt\"") |
