golangci-lint: enable importas linter

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-05-16 12:27:29 +02:00
parent 378e754c88
commit 9f68bc0a2b
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,7 @@ linters:
- gosec # Detects security problems.
- govet
- ineffassign
- importas # Enforces consistent import aliases.
- misspell # Detects commonly misspelled English words in comments.
- nakedret # Detects uses of naked returns.
- nilerr # Detects code that returns nil even if it checks that the error is not nil.
@ -108,6 +109,21 @@ linters:
lll:
line-length: 200
importas:
# Do not allow unaliased imports of aliased packages.
no-unaliased: true
alias:
# Enforce alias to prevent it accidentally being used instead of our
# own errdefs package (or vice-versa).
- pkg: github.com/containerd/errdefs
alias: cerrdefs
- pkg: github.com/opencontainers/image-spec/specs-go/v1
alias: ocispec
# Enforce that gotest.tools/v3/assert/cmp is always aliased as "is"
- pkg: gotest.tools/v3/assert/cmp
alias: is
nakedret:
# Disallow naked returns if func has more lines of code than this setting.
# Default: 30