parent
dc640a6ccb
commit
69093ef5de
8
main.go
8
main.go
|
@ -85,8 +85,7 @@ func main() {
|
||||||
marshal(sortmap)
|
marshal(sortmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
func header(w io.Writer, names map[string]string) {
|
func headerComment(w io.Writer) {
|
||||||
fmt.Fprintln(w, "package "+names["package"])
|
|
||||||
fmt.Fprintln(w, "")
|
fmt.Fprintln(w, "")
|
||||||
fmt.Fprintln(w, "// this file was autogenerated with autogenpb")
|
fmt.Fprintln(w, "// this file was autogenerated with autogenpb")
|
||||||
fmt.Fprintln(w, "//")
|
fmt.Fprintln(w, "//")
|
||||||
|
@ -94,6 +93,11 @@ func header(w io.Writer, names map[string]string) {
|
||||||
fmt.Fprintln(w, "//")
|
fmt.Fprintln(w, "//")
|
||||||
fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest")
|
fmt.Fprintln(w, "// go install go.wit.com/apps/autogenpb@latest")
|
||||||
fmt.Fprintln(w, "")
|
fmt.Fprintln(w, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func header(w io.Writer, names map[string]string) {
|
||||||
|
fmt.Fprintln(w, "package "+names["package"])
|
||||||
|
headerComment(w)
|
||||||
fmt.Fprintln(w, "import (")
|
fmt.Fprintln(w, "import (")
|
||||||
fmt.Fprintln(w, " \"fmt\"")
|
fmt.Fprintln(w, " \"fmt\"")
|
||||||
fmt.Fprintln(w, " \"os\"")
|
fmt.Fprintln(w, " \"os\"")
|
||||||
|
|
|
@ -20,10 +20,7 @@ func marshal(names map[string]string) {
|
||||||
w, _ := os.OpenFile(names["protobase"]+".marshal.pb.go", os.O_WRONLY|os.O_CREATE, 0600)
|
w, _ := os.OpenFile(names["protobase"]+".marshal.pb.go", os.O_WRONLY|os.O_CREATE, 0600)
|
||||||
|
|
||||||
fmt.Fprintln(w, "package "+names["package"])
|
fmt.Fprintln(w, "package "+names["package"])
|
||||||
fmt.Fprintln(w, "")
|
headerComment(w)
|
||||||
fmt.Fprintln(w, "// todo: autogen this")
|
|
||||||
fmt.Fprintln(w, "// functions to import and export the protobuf")
|
|
||||||
fmt.Fprintln(w, "")
|
|
||||||
fmt.Fprintln(w, "import (")
|
fmt.Fprintln(w, "import (")
|
||||||
fmt.Fprintln(w, " \"google.golang.org/protobuf/encoding/protojson\"")
|
fmt.Fprintln(w, " \"google.golang.org/protobuf/encoding/protojson\"")
|
||||||
fmt.Fprintln(w, " \"google.golang.org/protobuf/encoding/prototext\"")
|
fmt.Fprintln(w, " \"google.golang.org/protobuf/encoding/prototext\"")
|
||||||
|
|
|
@ -3,7 +3,7 @@ BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
test: vet
|
test: vet
|
||||||
|
|
||||||
all: clean test.pb.go run goimports vet
|
all: clean test.pb.go run vet
|
||||||
|
|
||||||
run:
|
run:
|
||||||
../autogenpb --proto test.proto --lobase gitTag --upbase GitTag --sort "ByPath,Refname"
|
../autogenpb --proto test.proto --lobase gitTag --upbase GitTag --sort "ByPath,Refname"
|
||||||
|
|
Loading…
Reference in New Issue