-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use golangci-lint instead of golint #400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default configuration of golangci-lint does not provide feature parity with the golint tool you are replacing in that it doesn't enforce doc comments. I think these comments are very important because they populate what would otherwise only be a skeleton of documentation on https://pkg.go.dev/. So it is worth enforcing their use.
There are two separate default configurations that cause this functionality to be missing:
- None of the several available linters that provide such a rule are enabled by default.
- golangci-lint has default exclusions for those rules
This can be overcome by adding a .golangci.yml
configuration file asset. I suggest this content:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go/.golangci.yml
# See: https://golangci-lint.run/usage/configuration/
issues:
exclude-use-default: false
linters:
enable:
- revive
I chose to remove the default exclusions entirely by setting the issues.exclude-use-default
configuration key to false
because the decision of the golangci-lint developers to exclude the valuable doc comment rules makes me think their exclusion choices can't be trusted. We can selectively add exclusions in the configuration file if we find they are actually needed in Arduino tooling projects.
The file will also need to be added to the installation instructions here:
https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Alessio!
golint
is deprecated, prefer usinggolangci-lint
instead