diff options
| author | Jeff Carr <[email protected]> | 2025-01-09 04:35:48 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-09 04:35:48 -0600 |
| commit | 62c93069c59cd03a3698b885a2ae2add2eef25bc (patch) | |
| tree | 152c8fdf3d41ef892fb518af1d617f13697e3272 /main.go | |
| parent | 213f719621e8fe107201b9393eda420ad7f54965 (diff) | |
protoc is running
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 31 |
1 files changed, 8 insertions, 23 deletions
@@ -138,41 +138,26 @@ func main() { } if argv.DryRun { - for k, v := range sortmap { - log.Info(k, "=", v) - } os.Exit(0) } // 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 - sortmap["protoc"] = protobase + ".pb.go" - if !shell.Exists(sortmap["protoc"]) { - if err := protocBuild(sortmap); err != nil { + + pbfile := f.Filebase + ".pb.go" + // try to create the foo.pb.go file using protoc if it is not there + if !shell.Exists(pbfile) { + if err := pb.protocBuild(f, pbfile); err != nil { log.Info("protoc build error:", err) os.Exit(-1) } - pb.addMutex(f) - // os.Exit(0) - /* - // experiment to add a mutex to the structs. - // this might fix my other not so great lock implementation on sort (?) - // seems to work, but proto.Marshal() breaks with nil reference - if argv.Mutex { - if err := addMutex(sortmap); err == nil { - // log.Info("adding mutex to existing protoc-gen-go file worked") - sortmap["mutex"] = "true" - sortmap["lock"] = "all" - } else { - log.Info("adding mutex to existing protoc-gen-go file did not work", err) - sortmap["mutex"] = "false" - } - } - */ } + // try to add the Mutex to the pb.go file + pb.addMutex(f) + // if foo.pb.go still doesn't exist, protoc failed // exit here if !shell.Exists(sortmap["protoc"]) { |
