From a4beeca8579f23560eb30ba3acd75a533ed1d4d8 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 9 Jan 2025 05:49:23 -0600 Subject: mutex's are being added to the protoc pb.go file --- main.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 81963b6..8feef5a 100644 --- a/main.go +++ b/main.go @@ -125,22 +125,23 @@ func main() { // this is helpful because the protoc-gen-go lines // are also annoying to code by hand - pbfile := f.Filebase + ".pb.go" + f.Pbfilename = 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) + if !shell.Exists(f.Pbfilename) { + if err := pb.protocBuild(f); err != nil { + badExit(err) } } // try to add the Mutex to the pb.go file - pb.addMutex(f) + if err := pb.addMutex(f); err != nil { + badExit(err) + } // if foo.pb.go still doesn't exist, protoc failed - if !shell.Exists(pbfile) { - log.Info("protoc build error.", pbfile) + if !shell.Exists(f.Pbfilename) { + log.Info("protoc build error.", f.Pbfilename) badExit(errors.New("failed to be created with protoc and proto-gen-go")) } -- cgit v1.2.3