Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(golangci-lint): Run linter on the directory #2367

Merged
merged 1 commit into from
Jun 30, 2019

Conversation

gnuletik
Copy link
Contributor

Fixes false positives from unused & typecheck linters.

For example:
mypackage/a.go has function myFunc()
mypackage/b.go use function myFunc()

threw a unused error in mypackage/a.go and a undef error in mypackage/b.go

This now checks the files in all directories instead of the current file/buffer

Fixes false positives from `unused` & `typecheck` linters.

For example:
mypackage/a.go has function `myFunc()`
mypackage/b.go use function `myFunc()`

threw a `unused` error in mypackage/a.go and a `undef` error in mypackage/b.go

This now check the files in all directories instead of the current file/buffer
@bhcleek
Copy link
Collaborator

bhcleek commented Jun 28, 2019

golangci-lint is only given the file to lint when linting on save. In that case, we only want to lint the file being saved.

@bhcleek
Copy link
Collaborator

bhcleek commented Jun 28, 2019

I understand why you want to do this, though. Perhaps the right solution is to filter the errors coming back from golangci-lint on the filenames. That's relatively easy to do with the job support in vim-go...

@bhcleek
Copy link
Collaborator

bhcleek commented Jun 29, 2019

Thank you for the PR. I'm going to merge this soon and extend it to support vim-go expected behavior.

@gnuletik
Copy link
Contributor Author

@bhcleek Thanks for having a look !

Yes filtering the errors on the current filename seems totally appropriate.
If you know how this can be done, okay :) I'm farily new to vimscript.

Thanks !

@bhcleek
Copy link
Collaborator

bhcleek commented Jun 29, 2019

Doing this as-is causes other problems, too. When not in GOPATH, golangci-lint run doesn't seem to report any problems when then argument it's given is a directory instead of a file.

@bhcleek
Copy link
Collaborator

bhcleek commented Jun 30, 2019

I created golangci/golangci-lint#592 to demonstrate the problem that golangci-lint is having. Since the problem is limited to null modules, I'll likely merge this PR with some additional changes soon.

bhcleek added a commit to bhcleek/vim-go that referenced this pull request Jun 30, 2019
Filter results of running the metalinter manually in preparation for
merging fatih#2367, so that merging fatih#2367 won't suddenly start reporting
results for all files in a package when the metalinter is golangci-lint
since golangci-lint does not have a way to filter its results to include
only the results for a single file.
@bhcleek bhcleek merged commit c6a304a into fatih:master Jun 30, 2019
bhcleek added a commit that referenced this pull request Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants