|
I have an autogenerated file in a go package in my project. I want to run the linters and formatters for all non autogenerated files in that go package. However I have trouble excluding the file via the Is this not possible or am I doing something wrong? |
Answered by
ldez
May 20, 2026
Replies: 1 comment 3 replies
|
Hello, The generated file should have a comment that follow the convention: https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source Note: in all cases, your files (generated or not) must compile https://golangci-lint.run/docs/welcome/faq/#why-is-it-not-possible-to-skipignore-typecheck-errors |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a problem with the way
goconstworks: it accumulates the occurrences from a package and report them for only one file.In your case, the report is on a sibling file of the generated one, so golangci-lint cannot exclude it as the report is not is the file to exclude.
Sadly, the
goconstbehavior cannot be controlled by golangci-lint.This is related to a new version of
goconst: the behavior has been extended to new symbols.In the next version of golangci-lint, I added an option
exclude-typesto restore the previous behavior.But before the next rel…