diff options
| author | Jeff Carr <[email protected]> | 2024-12-01 10:42:12 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-01 10:42:12 -0600 |
| commit | 2c8a813b714020681df1261af8937c1a106937f5 (patch) | |
| tree | 43f5f71b80dc80f7b7c48548b5632a20c8e256a5 /main.go | |
| parent | 3261af8db398bfe9a224c3a5f5448981709258d1 (diff) | |
fix mutex marshal nil panicv0.0.7
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -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" + } } } |
