Skip to content

Commit db92f53

Browse files
committed
golangci-lint: add gci
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
1 parent 935f961 commit db92f53

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ linters:
1212
- errchkjson
1313
- errorlint
1414
- exhaustive
15+
- gci
1516
- ginkgolinter
1617
- goconst
1718
- gocritic
@@ -45,6 +46,17 @@ linters-settings:
4546
disable:
4647
- fieldalignment
4748
- shadow
49+
gci:
50+
custom-order: true
51+
skip-generated: true
52+
sections:
53+
- standard
54+
- default
55+
- prefix(k8s.io)
56+
- prefix(sigs.k8s.io/controller-runtime)
57+
- prefix(github.com/multicluster-runtime)
58+
- blank
59+
- dot
4860
importas:
4961
no-unaliased: true
5062
alias:

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,13 @@ verify-apidiff: $(GO_APIDIFF) ## Check for API differences
183183

184184
go-version: ## Print the go version we use to compile our binaries and images
185185
@echo $(GO_VERSION)
186+
187+
WHAT ?=
188+
imports:
189+
@if [ -n "$(WHAT)" ]; then \
190+
$(GOLANGCI_LINT) run --enable-only=gci --fix --fast $(WHAT); \
191+
else \
192+
for MOD in . $$(git ls-files '**/go.mod' | sed 's,/go.mod,,'); do \
193+
(cd $$MOD; $(GOLANGCI_LINT) run --enable-only=gci --fix --fast); \
194+
done; \
195+
fi

0 commit comments

Comments
 (0)