mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 02:31:19 +00:00
0ea4b02b8b
* Added analyzer for detecting recursive/nested mutex read locks. * Added type assertion checks and removed unused 'iTypes' directory * Clean up * Bazel file fixes * Cleaned up code and added comments. Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
24 lines
615 B
Go
24 lines
615 B
Go
// These nested rlock patterns are too complex for the analyzer to catch right now
|
|
package testdata
|
|
|
|
func (p *ProtectResource) FuncLitInStructLit() {
|
|
p.RLock()
|
|
type funcLitContainer struct {
|
|
funcLit func()
|
|
}
|
|
var fl *funcLitContainer = &funcLitContainer{
|
|
funcLit: func() {
|
|
p.RLock()
|
|
},
|
|
}
|
|
fl.funcLit() // this is a nested RLock but won't be caught
|
|
p.RUnlock()
|
|
}
|
|
|
|
func (e *ExposedMutex) FuncReturnsMutex() {
|
|
e.GetLock().RLock()
|
|
e.lock.RLock() // this is an obvious nested lock, but won't be caught since the first RLock was called through a getter function
|
|
e.lock.RUnlock()
|
|
e.GetLock().RUnlock()
|
|
}
|