diff options
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 |
