diff options
| author | Jeff Carr <[email protected]> | 2025-01-11 02:44:21 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-11 02:44:21 -0600 |
| commit | 9349ab95fc91f74f2c242a7e3ccc0b630c3d95f3 (patch) | |
| tree | caaf75c3d0da4392a57e0d32b137435160b67d0e /addMutex.go | |
| parent | 3f2909aa0d95acc5b00642d082013afd40108a30 (diff) | |
small app works, example core dumps on Marshal()
Diffstat (limited to 'addMutex.go')
| -rw-r--r-- | addMutex.go | 15 |
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 } } |
