Fix lint errs (#59)
This commit is contained in:
@ -1,16 +1,15 @@
|
||||
# staticcheck
|
||||
|
||||
_staticcheck_ is `go vet` on steroids, applying a ton of static analysis
|
||||
checks you might be used to from tools like ReSharper for C#.
|
||||
_staticcheck_ offers extensive analysis of Go code, covering a myriad
|
||||
of categories. It will detect bugs, suggest code simplifications,
|
||||
point out dead code, and more.
|
||||
|
||||
## Installation
|
||||
|
||||
Staticcheck requires Go 1.6 or later.
|
||||
|
||||
go get honnef.co/go/tools/cmd/staticcheck
|
||||
See [the main README](https://github.com/dominikh/go-tools#installation) for installation instructions.
|
||||
|
||||
## Documentation
|
||||
|
||||
Detailed documentation can be found on
|
||||
[staticcheck.io](https://staticcheck.io/docs/staticcheck).
|
||||
[staticcheck.io](https://staticcheck.io/docs/).
|
||||
|
||||
|
@ -1,23 +1,30 @@
|
||||
// staticcheck detects a myriad of bugs and inefficiencies in your
|
||||
// code.
|
||||
// staticcheck analyses Go code and makes it better.
|
||||
package main // import "honnef.co/go/tools/cmd/staticcheck"
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"honnef.co/go/tools/lint"
|
||||
"honnef.co/go/tools/lint/lintutil"
|
||||
"honnef.co/go/tools/simple"
|
||||
"honnef.co/go/tools/staticcheck"
|
||||
"honnef.co/go/tools/stylecheck"
|
||||
"honnef.co/go/tools/unused"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fs := lintutil.FlagSet("staticcheck")
|
||||
gen := fs.Bool("generated", false, "Check generated code")
|
||||
fs.Parse(os.Args[1:])
|
||||
c := staticcheck.NewChecker()
|
||||
c.CheckGenerated = *gen
|
||||
cfg := lintutil.CheckerConfig{
|
||||
Checker: c,
|
||||
ExitNonZero: true,
|
||||
|
||||
checkers := []lint.Checker{
|
||||
simple.NewChecker(),
|
||||
staticcheck.NewChecker(),
|
||||
stylecheck.NewChecker(),
|
||||
}
|
||||
lintutil.ProcessFlagSet([]lintutil.CheckerConfig{cfg}, fs)
|
||||
|
||||
uc := unused.NewChecker(unused.CheckAll)
|
||||
uc.ConsiderReflection = true
|
||||
checkers = append(checkers, unused.NewLintChecker(uc))
|
||||
|
||||
lintutil.ProcessFlagSet(checkers, fs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user