surullabs / lint Goto Github PK
View Code? Open in Web Editor NEWRun linters from Go code -
Home Page: https://www.timeferret.com/lint
License: Apache License 2.0
Run linters from Go code -
Home Page: https://www.timeferret.com/lint
License: Apache License 2.0
I have default linter on top of 3 repository and it output false positive go vet error.
~/testlinter/src/meomap] 12s $ go test --run TestLint
--- FAIL: TestLint (2.33s)
lint_test.go:17: lint failures: govet.Check: /Users/meomap/testlinter/src/meomap/b/main.go:9: declaration of "foo" shadows declaration at /Users/meomap/testlinter/src/meomap/a/main.go:3
FAIL
exit status 1
FAIL meomap 2.342s
It seems the linter run this go vet command
$ go tool vet --shadow a/main.go b/main.go c/main.go
and I opened an issue at golang project here but it closed
Is there any reason why the vet command have to run with list of *.go
file instead of greedy argument .
?
To test a package with staticcheck
or gosimple
, I would need to pass some build tags, as I could do with errcheck
:
errcheck.Check{
Tags: "tag",
},
but gosimple.Check
or gostaticcheck.Check
do not take any tags as parameters, even though the tools themselves support them:
$ staticcheck --help
Usage of staticcheck:
staticcheck [flags] # runs on package in current directory
staticcheck [flags] packages
staticcheck [flags] directory
staticcheck [flags] files... # must be a single package
Flags:
-ignore string
Space separated list of checks to ignore, in the following format: 'import/path/file.go:Check1,Check2,...' Both the import path and file name sections support globbing, e.g. 'os/exec/*_test.go'
-min_confidence float
Deprecated; use -ignore instead
-tags build tags
List of build tags
$ gosimple --help
Usage of gosimple:
gosimple [flags] # runs on package in current directory
gosimple [flags] packages
gosimple [flags] directory
gosimple [flags] files... # must be a single package
Flags:
-ignore string
Space separated list of checks to ignore, in the following format: 'import/path/file.go:Check1,Check2,...' Both the import path and file name sections support globbing, e.g. 'os/exec/*_test.go'
-min_confidence float
Deprecated; use -ignore instead
-tags build tags
List of build tags
Is it just missing implementation or am I missing something?
Add it initially with all linters disabled and have users pick the ones they want manually.
This is useful for non-library projects.
Self-explanatory from the title!
internal/cert/utils.go:72:16: Error return value of `cmd.Wait` is not checked (errcheck)
defer cmd.Wait()
^
I think this is a bug, since defer
will check the error status. See https://golang.org/ref/spec#Defer_statements
If a deferred function value evaluates to nil, execution panics.
As suggested by @fortytw2 in #2, vendoring linters (especially gometalinter) will make it much easier to run this as part of a test suite since no internet access is needed.
https://travis-ci.org/surullabs/lint/builds/177229429
--- FAIL: TestGosimple (0.98s)
testutil.go:55: Check 1 /tmp/gosimpletest794064390/src/gosimpletest/file.go:6:1: expected declaration, found 'IDENT' sfsff
/tmp/gosimpletest794064390/src/gosimpletest/file.go:4:2: "fmt" imported but not used
/tmp/gosimpletest794064390/src/gosimpletest/file.go:4:2: "fmt" imported but not used
2016/11/19 08:38:32 couldn't load packages due to errors: gosimpletest
testutil.go:55: Check 2 /tmp/gosimpletest512030637/src/gosimpletest/file.go:3:2: "fmt" imported but not used
/tmp/gosimpletest512030637/src/gosimpletest/file.go:3:2: "fmt" imported but not used
2016/11/19 08:38:32 couldn't load packages due to errors: gosimpletest
FAIL
coverage: 57.1% of statements in github.com/surullabs/lint/gosimple, github.com/surullabs/lint/checkers
FAIL github.com/surullabs/lint/gosimple 0.990s
--- FAIL: TestGostaticcheck (0.99s)
testutil.go:55: Check 1 /tmp/gostaticchecktest241190326/src/gostaticchecktest/file.go:6:1: expected declaration, found 'IDENT' sfsff
/tmp/gostaticchecktest241190326/src/gostaticchecktest/file.go:4:2: "fmt" imported but not used
/tmp/gostaticchecktest241190326/src/gostaticchecktest/file.go:4:2: "fmt" imported but not used
2016/11/19 08:38:35 couldn't load packages due to errors: gostaticchecktest
testutil.go:55: Check 2 /tmp/gostaticchecktest611298205/src/gostaticchecktest/file.go:3:2: "fmt" imported but not used
/tmp/gostaticchecktest611298205/src/gostaticchecktest/file.go:3:2: "fmt" imported but not used
2016/11/19 08:38:35 couldn't load packages due to errors: gostaticchecktest
The change that triggered this error hasn't touched any of the failing packages.
The paths have been changed:
From https://groups.google.com/forum/#!topic/golang-nuts/fQQiO4OPdmQ
I have consolidated all of my Go tools in one place at
honnef.co/go/tools (backed by github.com/dominikh/go-tools)
This has changed a number of import paths. The command lines for
the tools now live at honnef.co/go/tools/cmd – for example,
staticcheck has moved from
honnef.co/go/staticcheck/cmd/staticcheck to
honnef.co/go/tools/cmd/staticcheck. Similarly, the supporting
libraries have moved to honnef.co/go/tools as well.
In order to make the transition as pain-free as possible, the old
import paths and GitHub repositories will keep working for a
limited time. Concretely, the following deprecation schedule is in
place:
1. Beginning now, the authoritative place for all code, issues
and pull requests is at github.com/dominikh/go-tools. The old
repositories will not receive new features or bug fixes. The old
import paths will – out of necessity – keep pointing to the old
repositories.
2. Starting March 1st, tools installed from the old locations
will unconditionally exit with a non-zero status code and emit a
deprecation warning. They will otherwise keep functioning like
normal.
3. Starting April 1st, all code in the old locations will be
removed and replaced with a single file causing a build failure,
instructing users to use the new location.
I am sorry for the inconvenience this causes. However, developing
all tools in a single repository will have benefits in the long
run and is worth the disruption.
Cheers,
Dominik
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.