-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add support for ignoring generated files #29
Comments
Interesting. I'm aware of the common practice to include that comment in generated files. I wasn't aware that linters should exclude those files though. TIL. My experience with other linters, such as Looking at golangci-lint's configuration it appears many of the linters offer analyzing generated code as an option, but as you suggest, it is a flag that can be enabled or disabled. Although, it also looks like golangci-lint excludes generated code files by default at the top-level across all linters by simply excluding any issues found in them, so adding a flag is probably not necessary. So far gochecknoglobals has been zero configuration, and folks who need more knobs use tools like golangci-lint that offer the additional knobs, and wrap gochecknoglobals and the many other linters available. I'm inclined to keep it as zero configuration unless there's strong need for configuration. @benjivesterby Are you using golangci-lint? If you are, and you have gochecknoglobals enabled, it shouldn't report generated code files since golangci-lint will exclude any issues found on them by default. If it isn't, we should investigate that. |
I'm using golangci-lint for some projects but not the one I'm running this on. It seemed like this was a missing feature other linters have which is why I submitted the issue. |
I think I'm inclined to add a flag like Thoughts anyone? |
Using the guidance here: https://pkg.go.dev/cmd/go/internal/generate
This tool should ignore files which contain the
^// Code generated .* DO NOT EDIT\.$
regex match.This can be a flag or default, but it should allow for ignoring those files.
The text was updated successfully, but these errors were encountered: