summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
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"
+ }
}
}