Skip to content

Commit fc8501c

Browse files
committed
Move Unlock under defer
1 parent 737cb4a commit fc8501c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arduino/discovery/discoverymanager/discoverymanager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ func (dm *DiscoveryManager) Watch() (*PortWatcher, error) {
150150
}
151151
watcher.closeCB = func() {
152152
dm.watchersMutex.Lock()
153+
defer dm.watchersMutex.Unlock()
153154
delete(dm.watchers, watcher)
154155
close(watcher.feed)
155-
dm.watchersMutex.Unlock()
156156
}
157157
go func() {
158158
dm.watchersMutex.Lock()

0 commit comments

Comments
 (0)