Skip to content

Commit 913a6be

Browse files
committed
Bump go and golangci-lint versions, fix lint
1 parent de11885 commit 913a6be

File tree

16 files changed

+140
-99
lines changed

16 files changed

+140
-99
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up go
2020
uses: actions/setup-go@v5
2121
with:
22-
go-version: '1.22.4'
22+
go-version: '1.24.1'
2323

2424
- uses: actions/checkout@v4
2525
with:
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up go
3737
uses: actions/setup-go@v5
3838
with:
39-
go-version: '1.22.4'
39+
go-version: '1.24.1'
4040

4141
- uses: actions/checkout@v4
4242
with:
@@ -61,7 +61,7 @@ jobs:
6161
- name: Set up go
6262
uses: actions/setup-go@v5
6363
with:
64-
go-version: '1.22.4'
64+
go-version: '1.24.1'
6565

6666
- uses: actions/checkout@v4
6767
with:
@@ -72,10 +72,10 @@ jobs:
7272
# There is a risk of drift between the two, but this is only linting,
7373
# not runtime correctness!
7474
- name: golangci-lint
75-
uses: golangci/golangci-lint-action@v6
75+
uses: golangci/golangci-lint-action@v7
7676
with:
7777
working-directory: git-sync
78-
version: v1.59.0
78+
version: v2.0.0
7979

8080
- name: make lint
8181
working-directory: git-sync

.golangci.yaml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,55 @@
22
# pass, in contrast to .golangci.yaml which defines checks that also the
33
# existing code passes.
44

5+
version: "2"
6+
57
run:
68
timeout: 30m
79

810
linters:
9-
disable-all: false
11+
default: all
12+
1013
enable: # please keep this alphabetized
11-
- ginkgolinter
12-
- gocritic
1314
- govet
1415
- ineffassign
15-
# Should we add logcheck, for consistency with kubernetes/kubernetes?
16-
# - logcheck
1716
- staticcheck
18-
- stylecheck
1917
- unused
18+
- gocritic
19+
- asasalint
20+
- copyloopvar
21+
22+
disable:
23+
- errcheck
24+
- cyclop
25+
- depguard
26+
- dupl
27+
- err113
28+
- exhaustruct
29+
- funlen
30+
- gochecknoglobals
31+
- gochecknoinits
32+
- gocognit
33+
- goconst # TODO: turn this one on
34+
- gocyclo
35+
- gosec # TODO: turn this one on
36+
- lll
37+
- maintidx
38+
- mnd
39+
- musttag
40+
- nestif
41+
- nlreturn
42+
- paralleltest
43+
- perfsprint
44+
- promlinter
45+
- recvcheck
46+
- revive
47+
- tagliatelle
48+
- testpackage
49+
- varnamelen
50+
- wrapcheck
51+
- wsl
2052

21-
linters-settings: # please keep this alphabetized
22-
gocritic:
23-
staticcheck:
24-
checks:
25-
- "all"
26-
stylecheck:
53+
settings: # please keep this alphabetized
54+
staticcheck:
55+
checks:
56+
- "all"

Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ IMAGE := $(REGISTRY)/$(BIN)
5151
TAG := $(VERSION)
5252
OS_ARCH_TAG := $(TAG)__$(OS)_$(ARCH)
5353

54-
BUILD_IMAGE ?= golang:1.22
54+
BUILD_IMAGE ?= golang:1.24
5555

5656
DBG_MAKEFILE ?=
5757
ifneq ($(DBG_MAKEFILE),1)
@@ -277,11 +277,8 @@ container-clean:
277277
bin-clean:
278278
rm -rf .go bin
279279

280-
lint-staticcheck:
281-
go run honnef.co/go/tools/cmd/staticcheck@2023.1.3
282-
283280
lint-golangci-lint:
284-
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.0 run
281+
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.0 run -v
285282

286283
lint-shellcheck:
287284
docker run \
@@ -292,4 +289,4 @@ lint-shellcheck:
292289
shellcheck \
293290
$$(git ls-files ':!:vendor' '*.sh')
294291

295-
lint: lint-staticcheck lint-golangci-lint lint-shellcheck
292+
lint: lint-golangci-lint lint-shellcheck

credential.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type credentialSliceValue struct {
4848
var _ pflag.Value = &credentialSliceValue{}
4949
var _ pflag.SliceValue = &credentialSliceValue{}
5050

51-
// pflagCredentialSlice is like pflag.StringSlice()
51+
// pflagCredentialSlice is like pflag.StringSlice().
5252
func pflagCredentialSlice(name, def, usage string) *[]credential {
5353
p := &credentialSliceValue{}
5454
_ = p.Set(def)

env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ type explicitFlag[T comparable] struct {
296296
flagPtr *T
297297
}
298298

299-
// newExplicitFlag allocates an explicitFlag
299+
// newExplicitFlag allocates an explicitFlag.
300300
func newExplicitFlag[T comparable](ptr *T, name, usage string, fn func(name string, value T, usage string) *T) {
301301
h := &explicitFlag[T]{
302302
realPtr: ptr,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ require (
2020
google.golang.org/protobuf v1.33.0 // indirect
2121
)
2222

23-
go 1.22
23+
go 1.23

0 commit comments

Comments
 (0)