Don't separately allocate sync.{Mutex,Once} if not necessary

Separate allocation of synchronization devices suggests they're shared
between objects, but they're not.
This commit is contained in:
greatroar
2020-11-04 09:51:20 +01:00
parent bb4b3481a6
commit c2f3eee5af
2 changed files with 3 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ type LocalVss struct {
FS
snapshots map[string]VssSnapshot
failedSnapshots map[string]struct{}
mutex *sync.RWMutex
mutex sync.RWMutex
msgError ErrorHandler
msgMessage MessageHandler
}
@@ -36,7 +36,6 @@ func NewLocalVss(msgError ErrorHandler, msgMessage MessageHandler) *LocalVss {
FS: Local{},
snapshots: make(map[string]VssSnapshot),
failedSnapshots: make(map[string]struct{}),
mutex: &sync.RWMutex{},
msgError: msgError,
msgMessage: msgMessage,
}