gnieto / mulint Goto Github PK
View Code? Open in Web Editor NEWGo lint which detects recursive locks, which may lead to dead locks
License: MIT License
Go lint which detects recursive locks, which may lead to dead locks
License: MIT License
Hi, thank you for writing this linter, as I could not find anything similar anywhere else!
I notice that mulint seems to only traverse function calls that are written as simple statements where the return value is not used. So if a function call is used in an expression then mulint will ignore it.
For example, mulint can detect this deadlock:
type someStruct struct {
m sync.RWMutex
}
func (s *someStruct) A() {
s.m.RLock()
s.B()
s.m.RUnlock()
}
func (s *someStruct) B() bool {
s.m.RLock() // This is a recursive lock and it should be detected by this tool
s.m.RUnlock()
return true
}
...but not this one:
type someStruct struct {
m sync.RWMutex
}
func (s *someStruct) A() {
s.m.RLock()
v := s.B() // ***** This is the only difference. *****
fmt.Println(v)
s.m.RUnlock()
}
func (s *someStruct) B() bool {
s.m.RLock() // This is a recursive lock and it should be detected by this tool
s.m.RUnlock()
return true
}
$ go get -u github.com/gnieto/mulint
go: github.com/gnieto/mulint upgrade => v0.0.0-20180313231918-24ec3193fbeb
go: finding module for package github.com/GoASTScanner/gas
go: found github.com/GoASTScanner/gas in github.com/GoASTScanner/gas v0.0.0-20200401082031-e946c8c39989
go: github.com/gnieto/mulint imports
github.com/gnieto/mulint/mulint imports
github.com/GoASTScanner/gas: github.com/GoASTScanner/[email protected]: parsing go.mod:
module declares its path as: github.com/securego/gosec
but was required as: github.com/GoASTScanner/gas
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.