summaryrefslogtreecommitdiff
path: root/addMutex.go
diff options
context:
space:
mode:
Diffstat (limited to 'addMutex.go')
-rw-r--r--addMutex.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/addMutex.go b/addMutex.go
index d0d8836..0bc4e19 100644
--- a/addMutex.go
+++ b/addMutex.go
@@ -14,7 +14,7 @@ import (
)
func (pf *File) syncLock(w io.Writer) {
- var LOCK string = pf.Bases.Lockname
+ var LOCK string = pf.Base.Lockname // if the Marshall code changes, this will have to change
fmt.Fprintln(w, "// a simple global lock")
fmt.Fprintln(w, "")
@@ -95,19 +95,20 @@ func (pf *File) structMatch(line string) bool {
start = "type " + msg.Name + " struct {"
if strings.HasPrefix(line, start) {
msg.MutexFound = true
+ msg.Lockname = "x.Lock"
return true
}
// ONLY PASS THIS IF YOU DO NOT WANT TO USE MARSHAL()
- if argv.Marshal {
- return false
- }
-
msg = pf.Base
start = "type " + msg.Name + " struct {"
if strings.HasPrefix(line, start) {
msg.MutexFound = true
+ if argv.Marshal {
+ // msg.Lockname = "fruitMu.Lock"
+ return false
+ }
return true
}
@@ -115,6 +116,10 @@ func (pf *File) structMatch(line string) bool {
start = "type " + msg.Name + " struct {"
if strings.HasPrefix(line, start) {
msg.MutexFound = true
+ if argv.Marshal {
+ // msg.Lockname = "fruitMu.Lock"
+ return false
+ }
return true
}
}