summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-01 10:42:12 -0600
committerJeff Carr <[email protected]>2024-12-01 10:42:12 -0600
commit2c8a813b714020681df1261af8937c1a106937f5 (patch)
tree43f5f71b80dc80f7b7c48548b5632a20c8e256a5 /main.go
parent3261af8db398bfe9a224c3a5f5448981709258d1 (diff)
fix mutex marshal nil panicv0.0.7
Diffstat (limited to 'main.go')
-rw-r--r--main.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/main.go b/main.go
index d9c32e2..00dd720 100644
--- a/main.go
+++ b/main.go
@@ -109,15 +109,16 @@ func main() {
// 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"
- sortmap["lock"] = "all"
- } else {
- log.Info("adding mutex to existing protoc-gen-go file did not work")
- sortmap["mutex"] = "false"
+ // 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")
+ sortmap["mutex"] = "false"
+ }
}
}