From 213f719621e8fe107201b9393eda420ad7f54965 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 9 Jan 2025 04:22:11 -0600 Subject: first pass parsing done --- main.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'main.go') 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 -- cgit v1.2.3