I try go1.16
import "embed"
I get
> golangci-lint run ./...
> Can't run linter goanalysis_metalinter: bodyclose: failed prerequisites ... could not import embed
how skip file/package in golangci-lint?
I try go1.16
import "embed"
I get
> golangci-lint run ./...
> Can't run linter goanalysis_metalinter: bodyclose: failed prerequisites ... could not import embed
how skip file/package in golangci-lint?
You can customize the behavior with a config file. Docs are here https://golangci-lint.run/usage/configuration/. Make a .golangci.yml
file that looks like this:
run:
skip-files:
- main.go
You can add //nolint
to the top of the file.
//nolint
package foo
run.skip-files
is deprecated. issues.exclude-files
instead. –
Andraandrade You may want to try linters.disable.body-close
. But this will simply disable the linter, whether the code works or not depends on you.
linters:
disable:
- bodyclose
An update on the previous answer by @steven-masley
run.skip-files
is deprecated and replaced withissues.exclude-files
as of 2024 March by this PR.run.skip-dirs
is also replaced byissues.exclude-dirs
.
Both run.skip-*
and issues.exclude-*
will still analyze the files, but simply not report them. Originally run.skip-*
has caused confusion to some (e.g. "why is it still taking so long even if I skipped a large file?"), which is why it has been replaced with issues.exclude-*
. (I personally don't see a huge difference.)
So if you have a large file you want to "actually" skip, you may want to refer to this answer.
© 2022 - 2024 — McMap. All rights reserved.