From 9a34961d3de3df092ab05d91150486166fe9a70a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 30 Nov 2024 23:20:10 -0600 Subject: only do mutex after proto Signed-off-by: Jeff Carr --- main.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 0ed518d..de1b12d 100644 --- a/main.go +++ b/main.go @@ -106,6 +106,18 @@ func main() { log.Info("protoc build error:", err) os.Exit(-1) } + + // experiment to add a mutex to the structs. + // this might fix my other not so great lock implementation on sort (?) + // not sure though because I haven't tried it. leave it here until + // I can test it + if err := addMutex(sortmap); err == nil { + log.Info("adding mutex to existing protoc-gen-go file worked") + sortmap["mutex"] = "true" + } else { + log.Info("adding mutex to existing protoc-gen-go file did not work") + sortmap["mutex"] = "false" + } } // if foo.pb.go still doesn't exist, protoc failed @@ -115,15 +127,6 @@ func main() { badExit(errors.New("failed to be created with protoc and proto-gen-go")) } - // add mutex - if err := addMutex(sortmap); err == nil { - log.Info("adding mutex to existing protoc-gen-go file worked") - sortmap["mutex"] = "true" - } else { - log.Info("adding mutex to existing protoc-gen-go file did not work") - sortmap["mutex"] = "false" - } - if argv.NoSort { log.Info("not making sort.pb.go file (--no-sort == true)") } else { -- cgit v1.2.3