aws / aws/aws-application-networking-k8s
Enforce Import Naming Schemes With Linter
- Dominant language
- Go
- Stars
- 278
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
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:
```
linters:
enable:
- importas
linters-settings:
importas:
sigs.k8s.io/gateway-api/apis/v1alpha2: gwv1alpha2
```
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.
Contributor guide
Research direction
Start by locating the vet/presubmit script and the repository's existing lint configuration, then inventory the import naming schemes mentioned in the issue, such as apimachineryv1 and anv1alpha1. Done means golangci-lint importas rules cover known/common imports, existing misnamed imports are corrected, and the presubmit check reports future violations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100