Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@quasilyte
Copy link
Member

Finds mismatching Lock+Unlock sequences.

Lock+RUnlock -> error
RLock+Unlock -> error
Lock+Unlock -> OK
RLock+RUnlock -> OK

It only checks the 2 adjusted statements.

We don't check for types being sync.Mutex or sync.RWMutex,
let's see how bad it will be for a false positive rates.
People could embed locks or implement custom Lock+Unlock methods.
We won't mark this checker as stable until it's properly tested,
so it shouldn't be a deal breaker.

Signed-off-by: Iskander Sharipov [email protected]

@quasilyte quasilyte force-pushed the quasilyte/addChecker/badLock branch 3 times, most recently from aa04fd4 to 4a14a7c Compare October 16, 2020 12:14
cristaloleg
cristaloleg previously approved these changes Oct 16, 2020
Finds mismatching Lock+Unlock sequences.

	Lock+RUnlock -> error
	RLock+Unlock -> error
	Lock+Unlock -> OK
	RLock+RUnlock -> OK

It only checks the 2 adjusted statements.

We don't check for types being sync.Mutex or sync.RWMutex,
let's see how bad it will be for a false positive rates.
People could embed locks or implement custom Lock+Unlock methods.
We won't mark this checker as stable until it's properly tested,
so it shouldn't be a deal breaker.

Signed-off-by: Iskander Sharipov <[email protected]>
@quasilyte quasilyte merged commit c16764c into master Oct 16, 2020
@quasilyte quasilyte deleted the quasilyte/addChecker/badLock branch October 16, 2020 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants