Currently, the naming schemes for imports are enforced through PR. We can improve this process by using a linter like golangci-lint as part of the vet/presubmit script. This way, developers will be informed of improperly named imports before the PR goes up.
We would want to set up rules for all known/common imports in the repo, such as apimachineryv1, anv1alpha1, etc.
When a new dependency is added, it will be up to the developer + reviewers to determine an import name that fits the scheme and add it to the linter's rules.
From my understanding, utilizing this linter would not automatically edit the existing import names, so the PR that introduces this would likely also require fixing all the misnamed imports too.
Currently, the naming schemes for imports are enforced through PR. We can improve this process by using a linter like golangci-lint as part of the vet/presubmit script. This way, developers will be informed of improperly named imports before the PR goes up.
Example YAML for golangci-lint:
We would want to set up rules for all known/common imports in the repo, such as
apimachineryv1
,anv1alpha1
, etc.When a new dependency is added, it will be up to the developer + reviewers to determine an import name that fits the scheme and add it to the linter's rules.
From my understanding, utilizing this linter would not automatically edit the existing import names, so the PR that introduces this would likely also require fixing all the misnamed imports too.