Skip to content

Commit 9f68bc0

Browse files
committed
golangci-lint: enable importas linter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 378e754 commit 9f68bc0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.golangci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ linters:
4040
- gosec # Detects security problems.
4141
- govet
4242
- ineffassign
43+
- importas # Enforces consistent import aliases.
4344
- misspell # Detects commonly misspelled English words in comments.
4445
- nakedret # Detects uses of naked returns.
4546
- nilerr # Detects code that returns nil even if it checks that the error is not nil.
@@ -108,6 +109,21 @@ linters:
108109
lll:
109110
line-length: 200
110111

112+
importas:
113+
# Do not allow unaliased imports of aliased packages.
114+
no-unaliased: true
115+
116+
alias:
117+
# Enforce alias to prevent it accidentally being used instead of our
118+
# own errdefs package (or vice-versa).
119+
- pkg: github.com/containerd/errdefs
120+
alias: cerrdefs
121+
- pkg: github.com/opencontainers/image-spec/specs-go/v1
122+
alias: ocispec
123+
# Enforce that gotest.tools/v3/assert/cmp is always aliased as "is"
124+
- pkg: gotest.tools/v3/assert/cmp
125+
alias: is
126+
111127
nakedret:
112128
# Disallow naked returns if func has more lines of code than this setting.
113129
# Default: 30

0 commit comments

Comments
 (0)