Skip to content

Commit 2e02c9e

Browse files
committed
Fix golangci + migrate to v2
Signed-off-by: apostasie <[email protected]>
1 parent bd7d830 commit 2e02c9e

File tree

2 files changed

+62
-59
lines changed

2 files changed

+62
-59
lines changed

mod/tigron/.golangci.yml

Lines changed: 55 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,65 @@
1-
---
2-
output:
3-
sort-results: true
4-
5-
issues:
6-
max-issues-per-linter: 0
7-
max-same-issues: 0
1+
version: "2"
82

93
run:
10-
concurrency: 0
11-
timeout: 5m
124
issues-exit-code: 2
13-
tests: true
145
modules-download-mode: readonly
156
allow-parallel-runners: true
167
allow-serial-runners: true
178

9+
issues:
10+
max-issues-per-linter: 0
11+
max-same-issues: 0
12+
1813
linters:
19-
disable-all: false
20-
enable-all: true
14+
default: all
2115
disable:
22-
# Opting-out
23-
- nonamedreturns # named returns are occasionally useful
24-
- exhaustruct # does not serve much of a purpose
25-
- funlen # not interested
26-
- cyclop # not interested much
27-
- godox # having these are useful
28-
# Duplicating
29-
- gci # we use go-imports instead
30-
# Deprecated
31-
- tenv
32-
# TODO: Temporarily out until we wrap up all of them
33-
# - wrapcheck
34-
35-
linters-settings:
36-
staticcheck:
37-
checks:
38-
- "all"
16+
- cyclop
17+
- exhaustruct
18+
- funlen
19+
- godox
20+
- nonamedreturns
21+
settings:
22+
depguard:
23+
rules:
24+
main:
25+
files:
26+
- $all
27+
allow:
28+
- $gostd
29+
- github.com/containerd/nerdctl/mod/tigron
30+
- github.com/creack/pty
31+
- github.com/rs/zerolog
32+
- github.com/rs/zerolog/log
33+
- go.uber.org/goleak
34+
- golang.org/x/sync/errgroup
35+
- golang.org/x/term
36+
- gotest.tools
37+
staticcheck:
38+
checks:
39+
- all
40+
exclusions:
41+
generated: disable
3942

40-
depguard:
41-
rules:
42-
main:
43-
files:
44-
- "$all"
45-
allow:
46-
- $gostd
47-
- "github.com/containerd/nerdctl/mod/tigron"
48-
# WATCHOUT! https://github.com/OpenPeeDeeP/depguard/issues/108
49-
# Currently, depguard will fail detecting any dependency starting with a standard package name as third-party.
50-
# Thus, the following three are allowed provisionally, though currently not "necessary".
51-
- "golang.org/x/sync"
52-
- "golang.org/x/term"
53-
- "gotest.tools"
54-
- "github.com/creack/pty"
43+
formatters:
44+
settings:
45+
gci:
46+
sections:
47+
- standard
48+
- default
49+
- prefix(go.farcloser.world)
50+
- localmodule
51+
no-inline-comments: true
52+
no-prefix-comments: true
53+
custom-order: true
54+
gofumpt:
55+
extra-rules: true
56+
golines:
57+
max-len: 100
58+
tab-len: 4
59+
shorten-comments: true
60+
enable:
61+
- gci
62+
- gofumpt
63+
- golines
64+
exclusions:
65+
generated: disable

mod/tigron/Makefile

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ endef
6060
lint: lint-go-all lint-imports lint-yaml lint-shell lint-commits lint-headers lint-mod lint-licenses-all
6161
test: test-unit test-unit-race test-unit-bench
6262
unit: test-unit test-unit-race test-unit-bench
63-
fix: fix-mod fix-imports fix-go-all
63+
fix: fix-mod fix-go-all
6464

6565
##########################
6666
# Linting tasks
6767
##########################
6868
lint-go:
69-
$(call title, $@)
69+
$(call title, $@: $(GOOS))
7070
@cd $(MAKEFILE_DIR) \
7171
&& golangci-lint run $(VERBOSE_FLAG_LONG) ./...
7272
$(call footer, $@)
@@ -139,7 +139,7 @@ lint-licenses-all:
139139
# Automated fixing tasks
140140
##########################
141141
fix-go:
142-
$(call title, $@)
142+
$(call title, $@: $(GOOS))
143143
@cd $(MAKEFILE_DIR) \
144144
&& golangci-lint run --fix
145145
$(call footer, $@)
@@ -153,12 +153,6 @@ fix-go-all:
153153
&& GOOS=windows make fix-go
154154
$(call footer, $@)
155155

156-
fix-imports:
157-
$(call title, $@)
158-
@cd $(MAKEFILE_DIR) \
159-
&& goimports-reviser -company-prefixes $(ORG_PREFIXES) ./...
160-
$(call footer, $@)
161-
162156
fix-mod:
163157
$(call title, $@)
164158
@cd $(MAKEFILE_DIR) \
@@ -180,13 +174,11 @@ install-dev-tools:
180174
# git-validation: main from 2023/11
181175
# ltag: v0.2.5
182176
# go-licenses: v2.0.0-alpha.1
183-
# goimports-reviser: v3.9.0
184177
@cd $(MAKEFILE_DIR) \
185178
&& go install github.com/golangci/golangci-lint/cmd/golangci-lint@0a603e49e5e9870f5f9f2035bcbe42cd9620a9d5 \
186179
&& go install github.com/vbatts/git-validation@679e5cad8c50f1605ab3d8a0a947aaf72fb24c07 \
187180
&& go install github.com/kunalkushwaha/ltag@b0cfa33e4cc9383095dc584d3990b62c95096de0 \
188-
&& go install github.com/google/go-licenses/v2@d01822334fba5896920a060f762ea7ecdbd086e8 \
189-
&& go install github.com/incu6us/goimports-reviser/v3@698f92d226d50a01731ca8551993ebc1bb7fc788
181+
&& go install github.com/google/go-licenses/v2@d01822334fba5896920a060f762ea7ecdbd086e8
190182
@echo "Remember to add GOROOT/bin to your path"
191183
$(call footer, $@)
192184

@@ -195,7 +187,7 @@ install-dev-tools:
195187
##########################
196188
test-unit:
197189
$(call title, $@)
198-
@go test $(VERBOSE_FLAG) $(MAKEFILE_DIR)/...
190+
@EXPERIMENTAL_HIGHK_FD=true go test $(VERBOSE_FLAG) $(MAKEFILE_DIR)/...
199191
$(call footer, $@)
200192

201193
test-unit-bench:
@@ -205,7 +197,7 @@ test-unit-bench:
205197

206198
test-unit-race:
207199
$(call title, $@)
208-
@go test $(VERBOSE_FLAG) $(MAKEFILE_DIR)/... -race
200+
@EXPERIMENTAL_HIGHK_FD=true go test $(VERBOSE_FLAG) $(MAKEFILE_DIR)/... -race
209201
$(call footer, $@)
210202

211203
.PHONY: \
@@ -216,5 +208,5 @@ test-unit-race:
216208
unit \
217209
install-dev-tools \
218210
lint-commits lint-go lint-go-all lint-headers lint-imports lint-licenses lint-licenses-all lint-mod lint-shell lint-yaml \
219-
fix-go fix-go-all fix-imports fix-mod \
211+
fix-go fix-go-all fix-mod \
220212
test-unit test-unit-race test-unit-bench

0 commit comments

Comments
 (0)