-
-
Notifications
You must be signed in to change notification settings - Fork 274
fix(golangcilint): lint current buffer instead of parent directory #820
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
base: master
Are you sure you want to change the base?
Conversation
This breaks 'normal' setups where there is a I do see the problem you are seeing, but I don't have a good idea for how to get around it. |
One possibility is to run |
I've pushed up 292100c with this change. |
It looks like when This will fail to work if you have a session with a one-off file and other files within a project since, as currently written, it will only evaluate the |
FWIW, it doesn't seem like the current |
@cativovo @JonnyLoughlin does this look okay to you? Overall I'm not too happy about how golangcilint gets more complex and complex. Compared to other linters this thing is a beast. |
I can confirm this doesn't break any existing set ups for me. The reference from golangcilint that I can find for linting without a Thoughts separate from this specific issue and morose on golangci and nvim-lint in general: I agree that overall complexity of golangcilint's config, relative to other linters, feels like a lot. Golangci can be used in so may different ways and I don't think the burden of ensuring nvim-lint works, without further configuration, with all of them should fall on you. I don't think it is reasonable nvim-lint to work out of the box with every possible golangci-lint use-case. Users are always free to modify the linter arguments to suite their specific config needs. At a certain point, I wonder if it would be worth providing a reasonable set of default args to run recent versions of golangci-lint with default options, and then maybe document the actual golangcilint.lua file with some common |
Currently the
golangcilint
linter is providing the parent directory as the file argument to thegolangci-lint
linter. This doesn't work when working in an individual golang file that isn't apart of a standard golang package directory.Here is the error I get when editing a single standalone golang file. which returns a
5
exit code:ERRO Running error: context loading failed: no go files to analyze: running `go mod tidy` may solve the problem
Here is how to reproduce it:
# Directory structure hello_world └── main.go 1 directory, 1 file
# Run golangci-lint golangci-lint run --out-format json --issues-exit-code=0 --show-stats=false --print-issued-lines=false --print-linter-name=false hello_world
When I run
golanci-lint
directly against themain.go
file, it works as expected: