summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/main.go b/main.go
index a9d1972..4438297 100644
--- a/main.go
+++ b/main.go
@@ -103,11 +103,21 @@ func main() {
protobase := strings.TrimSuffix(argv.Proto, ".proto")
f.Filebase = protobase
- if err := pb.findGlobalAutogenpb(f); err != nil {
+ // parse the .proto file
+ if err := pb.protoParse(f); err != nil {
log.Info("autogenpb parse error:", err)
os.Exit(-1)
}
+ // parse sort & marshal options from the .proto file
+ // this goes through the .proto files and looks
+ // for `autogenpb: ` lines
+ if err := pb.protoParseNew(f); err != nil {
+ log.Info("autogenpb parse error:", err)
+ os.Exit(-1)
+ }
+
+ // this should be garbage soon
sortmap = make(map[string]string)
sortmap["package"] = packageName
sortmap["protofile"] = argv.Proto
@@ -134,14 +144,6 @@ func main() {
os.Exit(0)
}
- // parse sort & marshal options from the .proto file
- // this goes through the .proto files and looks
- // for `autogenpb: ` lines
- if err := pb.findAutogenpb(f); err != nil {
- log.Info("autogenpb parse error:", err)
- os.Exit(-1)
- }
-
// try to make foo.pb.go with protoc if it's not here
// this is helpful because the protoc-gen-go lines
// are also annoying to code by hand