Skip to content

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

@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
@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