Skip to content
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

Merged
merged 2 commits into from
Sep 29, 2023
Merged

Conversation

alessio-perugini
Copy link
Contributor

golint is deprecated, prefer using golangci-lint instead

Copy link
Contributor

@per1234 per1234 left a 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:

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

workflow-templates/assets/check-go-task/Taskfile.yml Outdated Show resolved Hide resolved
workflow-templates/check-go-task.yml Show resolved Hide resolved
workflow-templates/check-go-task.yml Show resolved Hide resolved
@per1234 per1234 added the type: enhancement Proposed improvement label Sep 29, 2023
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alessio!

@alessio-perugini alessio-perugini merged commit 0ed1c89 into main Sep 29, 2023
41 checks passed
@alessio-perugini alessio-perugini deleted the use-golangci-lint branch September 29, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants