diff options
| author | Jeff Carr <[email protected]> | 2025-01-10 19:37:32 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-10 19:37:32 -0600 |
| commit | 22651438692cf991be22d8898e5727f586fd2f11 (patch) | |
| tree | b7e4936ca077f315af8d49908d0c14a5a1791411 /addMutex.go | |
| parent | dc86ae010f688eefc5f4757d1c6eb620effc68f9 (diff) | |
correctly identify the two primary structs
Diffstat (limited to 'addMutex.go')
| -rw-r--r-- | addMutex.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/addMutex.go b/addMutex.go index ff2aec5..cfd31b3 100644 --- a/addMutex.go +++ b/addMutex.go @@ -69,8 +69,25 @@ func (pb *Files) addMutex(f *File) error { // is this struct supposed to have a Mutex added? func (pf *File) structMatch(line string) bool { - for _, msg := range pf.MsgNames { - start := "type " + msg.Name + " struct {" + var msg *MsgName + var start string + + msg = pf.Bases + start = "type " + msg.Name + " struct {" + if strings.HasPrefix(line, start) { + msg.MutexFound = true + return true + } + + msg = pf.Base + start = "type " + msg.Name + " struct {" + if strings.HasPrefix(line, start) { + msg.MutexFound = true + return true + } + + for _, msg = range pf.MsgNames { + start = "type " + msg.Name + " struct {" if strings.HasPrefix(line, start) { msg.MutexFound = true return true |
