Skip to content

Commit b445d70

Browse files
authored
Use go 1.24 and golangci-lint v2 (#1023)
1 parent 52bd4f4 commit b445d70

File tree

626 files changed

+52208
-9490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+52208
-9490
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ jobs:
88
unit-tests:
99
name: unit-tests
1010
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
go: ['1.23']
1411

1512
steps:
1613
- name: install make
1714
run: sudo apt-get install make
1815
- name: set up go 1.x
1916
uses: actions/setup-go@v3
2017
with:
21-
go-version: ${{ matrix.go }}
18+
go-version: '1.24'
2219
- name: checkout
2320
uses: actions/checkout@v3
2421
- name: run build
@@ -28,7 +25,6 @@ jobs:
2825
- name: check clean vendors
2926
run: go mod vendor
3027
- name: upload coverage to codecov.io
31-
if: ${{ matrix.go == '1.23' }}
3228
uses: codecov/codecov-action@v4
3329
with:
3430
files: ./cover.out

.github/workflows/pull_request_e2e.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ jobs:
1010
e2e-tests:
1111
name: e2e-tests
1212
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
go: ['1.23']
1613

1714
steps:
1815
- name: install make
1916
run: sudo apt-get install make
2017
- name: set up go 1.x
2118
uses: actions/setup-go@v3
2219
with:
23-
go-version: ${{ matrix.go }}
20+
go-version: '1.24'
2421
- name: checkout
2522
uses: actions/checkout@v3
2623
- name: run build

.github/workflows/push_image.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ jobs:
1313
push-image:
1414
name: push image
1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
go: ['1.23']
1916
steps:
2017
- name: install make
2118
run: sudo apt-get install make
2219
- name: set up go 1.x
2320
uses: actions/setup-go@v3
2421
with:
25-
go-version: ${{ matrix.go }}
22+
go-version: '1.24'
2623
- name: checkout
2724
uses: actions/checkout@v3
2825
- name: docker login to quay.io
@@ -44,16 +41,13 @@ jobs:
4441
codecov:
4542
name: Codecov upload
4643
runs-on: ubuntu-latest
47-
strategy:
48-
matrix:
49-
go: ['1.23']
5044
steps:
5145
- name: install make
5246
run: sudo apt-get install make
5347
- name: set up go 1.x
5448
uses: actions/setup-go@v3
5549
with:
56-
go-version: ${{ matrix.go }}
50+
go-version: '1.24'
5751
- name: checkout
5852
uses: actions/checkout@v3
5953
- name: Test

.github/workflows/push_image_pr.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ jobs:
1414
if: ${{ github.event.label.name == 'ok-to-test' }}
1515
name: push PR image
1616
runs-on: ubuntu-latest
17-
strategy:
18-
matrix:
19-
go: ['1.23']
2017
steps:
2118
- name: install make
2219
run: sudo apt-get install make
2320
- name: set up go 1.x
2421
uses: actions/setup-go@v3
2522
with:
26-
go-version: ${{ matrix.go }}
23+
go-version: '1.24'
2724
- name: checkout
2825
uses: actions/checkout@v3
2926
with:

.github/workflows/release.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
push-image:
1313
name: push image
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
go: ['1.23']
1815
steps:
1916
- name: checkout
2017
uses: actions/checkout@v3
@@ -34,7 +31,7 @@ jobs:
3431
- name: set up go 1.x
3532
uses: actions/setup-go@v3
3633
with:
37-
go-version: ${{ matrix.go }}
34+
go-version: '1.24'
3835
- name: docker login to quay.io
3936
uses: docker/login-action@v2
4037
with:

.golangci.yml

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,59 @@
1+
version: "2"
2+
run:
3+
go: "1.23"
14
linters:
25
enable:
3-
- errcheck
4-
- errorlint
6+
- copyloopvar
57
- cyclop
8+
- errcheck
69
- errname
10+
- errorlint
711
- exhaustive
8-
- copyloopvar
912
- gocritic
10-
- gofmt
11-
- gosimple
1213
- govet
1314
- ineffassign
1415
- revive
1516
- staticcheck
16-
- stylecheck
17-
- typecheck
1817
- unused
19-
run:
20-
go: "1.22"
21-
linters-settings:
22-
gocritic:
23-
enabled-checks:
24-
- hugeParam
25-
- rangeExprCopy
26-
- rangeValCopy
27-
- indexAlloc
28-
settings:
29-
ifElseChain:
30-
minThreshold: 3
31-
cyclop:
32-
max-complexity: 20
18+
settings:
19+
cyclop:
20+
max-complexity: 20
21+
gocritic:
22+
enabled-checks:
23+
- hugeParam
24+
- rangeExprCopy
25+
- rangeValCopy
26+
- indexAlloc
27+
settings:
28+
ifElseChain:
29+
minThreshold: 3
30+
exclusions:
31+
generated: lax
32+
presets:
33+
- comments
34+
- common-false-positives
35+
- legacy
36+
- std-error-handling
37+
paths:
38+
- third_party$
39+
- builtin$
40+
- examples$
41+
rules:
42+
- linters:
43+
- staticcheck
44+
text: "QF1003:"
45+
- linters:
46+
- staticcheck
47+
text: "QF1008:"
48+
- linters:
49+
- revive
50+
text: "avoid meaningless package names"
51+
formatters:
52+
enable:
53+
- gofmt
54+
exclusions:
55+
generated: lax
56+
paths:
57+
- third_party$
58+
- builtin$
59+
- examples$

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ifneq ($(CLEAN_BUILD),)
4141
LDFLAGS ?= -X 'main.buildVersion=${VERSION}-${BUILD_SHA}' -X 'main.buildDate=${BUILD_DATE}'
4242
endif
4343

44-
GOLANGCI_LINT_VERSION = v1.61.0
44+
GOLANGCI_LINT_VERSION = v2.2.1
4545
KIND_VERSION = v0.22.0
4646

4747
FLP_BIN_FILE=flowlogs-pipeline
@@ -101,7 +101,9 @@ help: ## Display this help.
101101
.PHONY: prereqs
102102
prereqs: ## Check if prerequisites are met, and install missing dependencies
103103
@echo "### Checking if prerequisites are met, and installing missing dependencies"
104-
GOFLAGS="" go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
104+
test -f ./bin/golangci-lint-${GOLANGCI_LINT_VERSION} || ( \
105+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s ${GOLANGCI_LINT_VERSION} \
106+
&& mv ./bin/golangci-lint ./bin/golangci-lint-${GOLANGCI_LINT_VERSION})
105107

106108
.PHONY: prereqs-kind
107109
prereqs-kind: ## Check if prerequisites are met for running kind, and install missing dependencies
@@ -117,7 +119,7 @@ vendors: ## Check go vendors
117119

118120
.PHONY: lint
119121
lint: prereqs ## Lint the code
120-
golangci-lint run ./... --timeout=3m
122+
./bin/golangci-lint-${GOLANGCI_LINT_VERSION} run ./... --timeout=3m
121123

122124
.PHONY: compile
123125
compile: ## Compile main flowlogs-pipeline and config generator

contrib/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG TARGETARCH
2-
FROM docker.io/library/golang:1.23 as builder
2+
FROM docker.io/library/golang:1.24 as builder
33

44
ARG TARGETARCH=amd64
55
ARG LDFLAGS

contrib/docker/Dockerfile.downstream

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BUILDVERSION
22

3-
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.23 as builder
3+
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.24 as builder
44
ARG BUILDVERSION
55

66
WORKDIR /app

go.mod

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/netobserv/flowlogs-pipeline
22

3-
go 1.23.0
3+
go 1.24.0
44

5-
toolchain go1.23.4
5+
toolchain go1.24.4
66

77
require (
88
github.com/Knetic/govaluate v3.0.1-0.20250325060307-7625b7f8c03d+incompatible
@@ -45,9 +45,9 @@ require (
4545
google.golang.org/grpc v1.73.0
4646
google.golang.org/protobuf v1.36.6
4747
gopkg.in/yaml.v2 v2.4.0
48-
k8s.io/api v0.32.3
49-
k8s.io/apimachinery v0.32.3
50-
k8s.io/client-go v0.32.3
48+
k8s.io/api v0.33.2
49+
k8s.io/apimachinery v0.33.2
50+
k8s.io/client-go v0.33.2
5151
sigs.k8s.io/e2e-framework v0.6.0
5252
)
5353

@@ -87,7 +87,6 @@ require (
8787
github.com/google/gnostic-models v0.6.9 // indirect
8888
github.com/google/go-cmp v0.7.0 // indirect
8989
github.com/google/go-jsonnet v0.20.0
90-
github.com/google/gofuzz v1.2.0 // indirect
9190
github.com/google/uuid v1.6.0 // indirect
9291
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
9392
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect

0 commit comments

Comments
 (0)