Hello
I am running golangci-lint from the golang extention, latest vscode version and latest golang extention.
the problem is that I have excluded some test in the .golangci.yml file, however when vscode runs golangci-lint, the errors are shown.
How can I tell vscode to also use the .golangci.yml file I have in the workspace directory ?
.golangci.yml file :
run:
deadline: 5m
issues:
max-issues-per-linter: 0
max-same-issues: 0
# disable some excludes that golangci-lint has by default. see https://github.com/golangci/golangci-lint
exclude-use-default: false
exclude-rules:
# Disable duplicate code or unused params validation in testing
- path: _test\.go$
linters:
- dupl
- unparam
# These checks are not really useful
- linters:
- errcheck
text: "Error return value of `.*(Close|Remove)` is not checked"
# We read arbitrary files in build system, it's not a problem
- path: build/
linters:
- gosec
text: "Potential file inclusion via variable"
# We run arbitrary subprocesses in build system, it's not a problem
- path: build/
linters:
- gosec
text: "Subprocess (launching should be audited|launched with variable)"
linters:
enable-all: true
disable:
# This project does not have a rule to have no globals
- gochecknoglobals
# This project does not have a rule to have no inits
- gochecknoinits
# This test has too many false positives
- gocyclo
# This project does not have a standard line length
- lll
# This project does not have a rule to forbid naked returns
- nakedret
# This project does not care about optimizing out few bytes of memory
- maligned
Hi!
Can you reproduce it without VS Code? Where is .golangci.yml located?
hello
.golangci.yml is located in the workspace root.
I am seeing similar behavior. This seems to be an issue when VSCode runs golangci-lint from within a package. If it executes golangci-lint from the root, the settings from .golangci.yml are applied.
Not sure what the right solution here is though 馃槙
I found the solution in #582
"go.lintFlags": [
"--config=${workspaceFolder}/.golangci.yml",
"--fast"
],
Since we have a solution I am closing this issue. Feel free to comment if more things need to be made clear.
Most helpful comment
I found the solution in #582