Skip to content

Commit 1cf520c

Browse files
Bump golangci linter
Signed-off-by: alexander-demicev <alexandr.demicev@suse.com>
1 parent e3332ff commit 1cf520c

37 files changed

+189
-82
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
- name: golangci-lint
2424
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # tag=v9.2.0
2525
with:
26-
version: v2.5.0
26+
version: v2.10.1
2727
args: --timeout 15m
2828
- name: golangci-lint-test
2929
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # tag=v9.2.0
3030
with:
31-
version: v2.5.0
31+
version: v2.10.1
3232
args: --build-tags e2e --timeout 15m
3333
working-directory: test

.github/workflows/trivy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
go-version: ${{ steps.vars.outputs.go_version }}
2525
- name: Build image
2626
run: |
27-
make docker-build CONTROLLER_IMG=localhost/cluster-api-operator:ci
27+
make docker-build CONTROLLER_IMG_TAG=cluster-api-operator:ci
2828
- name: Run Trivy vulnerability scanner
29-
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # tag=v0.28.0
29+
uses: aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478 # tag=0.34.2
3030
with:
31-
image-ref: "localhost/cluster-api-operator:ci"
31+
image-ref: "cluster-api-operator:ci"
3232
format: "table"
3333
exit-code: "1"
3434
severity: "CRITICAL,HIGH"

.golangci.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: "2"
22
run:
3-
go: "1.24"
3+
go: "1.25.7"
44
allow-parallel-runners: true
55
linters:
66
default: none
@@ -55,8 +55,12 @@ linters:
5555
- usestdlibvars
5656
- wastedassign
5757
- whitespace
58-
- wsl
58+
- wsl_v5
5959
settings:
60+
wsl_v5:
61+
allow-first-in-block: true
62+
allow-whole-block: false
63+
branch-max-lines: 2
6064
goheader:
6165
values:
6266
regexp:
@@ -153,7 +157,7 @@ linters:
153157
- linters:
154158
- dogsled
155159
- gosec
156-
- wsl
160+
- wsl_v5
157161
path: internal/envtest/environment.go
158162
# Not all platforms are supported by this operator, those which aren't
159163
# supported will be caught by the default case in the switches.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ROOT:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2323

2424
.DEFAULT_GOAL:=help
2525

26-
GO_VERSION ?= 1.24.4
26+
GO_VERSION ?= 1.25.7
2727
GO_BASE_CONTAINER ?= docker.io/library/golang
2828
GO_CONTAINER_IMAGE = $(GO_BASE_CONTAINER):$(GO_VERSION)
2929

@@ -83,7 +83,7 @@ CONTROLLER_GEN_VER := v0.19.0
8383
CONTROLLER_GEN_BIN := controller-gen
8484
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)
8585

86-
GOLANGCI_LINT_VER := v2.5.0
86+
GOLANGCI_LINT_VER := v2.10.1
8787
GOLANGCI_LINT_BIN := golangci-lint
8888
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
8989

api/v1alpha2/addonprovider_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (b *AddonProvider) ProviderName() string {
5555
}
5656

5757
func (b *AddonProviderList) GetItems() []GenericProvider {
58-
providers := []GenericProvider{}
58+
providers := make([]GenericProvider, 0, len(b.Items))
5959

6060
for index := range b.Items {
6161
providers = append(providers, &b.Items[index])

api/v1alpha2/bootstrapprovider_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (b *BootstrapProvider) ProviderName() string {
5555
}
5656

5757
func (b *BootstrapProviderList) GetItems() []GenericProvider {
58-
providers := []GenericProvider{}
58+
providers := make([]GenericProvider, 0, len(b.Items))
5959

6060
for index := range b.Items {
6161
providers = append(providers, &b.Items[index])

api/v1alpha2/ipamprovider_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (p *IPAMProvider) ProviderName() string {
5555
}
5656

5757
func (p *IPAMProviderList) GetItems() []GenericProvider {
58-
providers := []GenericProvider{}
58+
providers := make([]GenericProvider, 0, len(p.Items))
5959

6060
for index := range p.Items {
6161
providers = append(providers, &p.Items[index])

api/v1alpha2/runtimeextensionprovider_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (p *RuntimeExtensionProvider) ProviderName() string {
5555
}
5656

5757
func (p *RuntimeExtensionProviderList) GetItems() []GenericProvider {
58-
providers := []GenericProvider{}
58+
providers := make([]GenericProvider, 0, len(p.Items))
5959

6060
for index := range p.Items {
6161
providers = append(providers, &p.Items[index])

cmd/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func main() {
142142
pflag.Parse()
143143

144144
ctrl.SetLogger(textlogger.NewLogger(textlogger.NewConfig()))
145+
145146
restConfig := ctrl.GetConfigOrDie()
146147

147148
tlsOptions, metricsOptions, err := flags.GetManagerOptions(managerOptions)

cmd/plugin/cmd/delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ func (d *DeleteGroup) execute(ctx context.Context, cl ctrlclient.Client) error {
237237

238238
if err := wait.ExponentialBackoff(opts, func() (bool, error) {
239239
ready := true
240+
240241
for i := range d.providers {
241242
if done, err := deleteProviders(ctx, cl, d.providers[i], ctrlclient.MatchingFieldsSelector{
242243
Selector: fields.SelectorFromSet(d.selectors[i]),

0 commit comments

Comments
 (0)