Comments (12)
Is there a particular reason gometalinter was written to operate on *.go rather than assuming operation on directories at a time?
from gometalinter.
Yes. If you have a directory foo
then structcheck foo
will error out with: cannot find package "foo"
(as it assumes an absolute package path). If you do structcheck ./foo
it works, or if you do ./foo/*.go
it works (though apparently not ideally). However, gometalinter
normalises directory names for de-duplication, so even if you use gometalinter ./foo
it will be normalised to foo
. To work around this, gometalinter
would need to either not normalise paths, or normalise, then ensure the path looks like a path again. The latter may be possible.
from gometalinter.
This is reproducible even running gometalinter on gometalinter
regression_tests/deadcode_test.go:13:14:warning: unused struct field undeclared name: Issues (structcheck)
regression_tests/deadcode_test.go:16:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/defercheck_test.go:17:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/dupl_test.go:32:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/errcheck_test.go:14:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/gocyclo_test.go:65:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/golint_test.go:14:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/gotype_test.go:15:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/ineffassign_test.go:14:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/structcheck_test.go:15:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/varcheck_test.go:13:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/vet_shadow_test.go:19:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
regression_tests/vet_test.go:10:2:warning: unused struct field undeclared name: ExpectIssues (structcheck)
One option is to cd ./foo && structcheck .
from gometalinter.
That worked!
from gometalinter.
Hmm, except it broke the tests.
from gometalinter.
Error: Not equal: regression_tests.Issues{regression_tests.Issue{Linter:"structcheck", Severity:"warning", Path:"test.go", Line:4, Col:2, Message:"unused struct field test.test.unused"}} (expected)
!= regression_tests.Issues{regression_tests.Issue{Linter:"structcheck", Severity:"warning", Path:"test.go", Line:4, Col:2, Message:"unused struct field github.com/alecthomas/gometalinter/regression_tests/.test.unused"}} (actual)
:( I prefer the older version.
In general though, isn't cd $1 && {$CMD} .
a probably better model than *.go? I imagine most tools will work better with it.
from gometalinter.
At least the tools that don't recurse into subdirectories.
from gometalinter.
That would modify vet and varcheck.
from gometalinter.
Well, there's no "better" here, they all work completely differently. Even tools from the same author work differently. So I basically just try different approaches and use whatever works.
from gometalinter.
What are your thoughts on changing vet and varcheck to match the "cd &&" model? I think it's closer to what most people do so is probably more future proof.
from gometalinter.
The dupl change may be too aggressive. It's the output we eventually want (with dupl running on ./...) but metalinter runs it on subdirectories so you end up dupl-ing into subdirectories multiple times.
from gometalinter.
Ah yes, got a little carried away there.
from gometalinter.
Related Issues (20)
- Add goreturns HOT 2
- go get failing due to kingping HOT 2
- The order of CLI flags aren't respected in combination with the config HOT 1
- Error when installing metalinter with vim-go HOT 2
- Adding support for power(ppc64le) arch HOT 9
- gometalinter does not invoke golint correctly HOT 1
- How to set the cyclomatic complexity value when using gometalinter? HOT 1
- Not reporting results from linters to VSCode HOT 4
- Remove supports for megacheck, unused, gosimple
- install.sh not working under Windows HOT 1
- The return value of calling gometalinterwith shell is not 0 HOT 5
- Add impi HOT 1
- gometalinter 3.0.0 is still looking for gosimple HOT 3
- Install failing on go 1.6.1 HOT 1
- vendor not work in go 1.10+ HOT 5
- Archive gometalinter HOT 22
- go mod vendor error HOT 4
- unknown linters: gosec
- Unmatched checksum HOT 4
- gometalinter doesn't work with golang 1.12.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gometalinter.