From 3e69f5d088d121f1d3c4bf44ca637a48f13c4819 Mon Sep 17 00:00:00 2001 From: Bhasker Hariharan Date: Wed, 3 Mar 2021 12:18:04 -0800 Subject: Add checklocks analyzer. This validates that struct fields if annotated with "// checklocks:mu" where "mu" is a mutex field in the same struct then access to the field is only done with "mu" locked. All types that are guarded by a mutex must be annotated with // +checklocks: For more details please refer to README.md. PiperOrigin-RevId: 360729328 --- pkg/sync/mutex_unsafe.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg/sync/mutex_unsafe.go') diff --git a/pkg/sync/mutex_unsafe.go b/pkg/sync/mutex_unsafe.go index 4e49a9b89..411a80a8a 100644 --- a/pkg/sync/mutex_unsafe.go +++ b/pkg/sync/mutex_unsafe.go @@ -72,6 +72,7 @@ func (m *Mutex) Lock() { // Preconditions: // * m is locked. // * m was locked by this goroutine. +// +checklocksignore func (m *Mutex) Unlock() { noteUnlock(unsafe.Pointer(m)) m.m.Unlock() -- cgit v1.2.3