Skip to content

Commit 5a65b97

Browse files
authored
Merge pull request #1472 from kubernetes-sigs/dependabot/github_actions/golangci/golangci-lint-action-8.0.0
chore(deps): bump golangci/golangci-lint-action from 6.5.2 to 8.0.0
2 parents cb024bb + bc26a08 commit 5a65b97

File tree

11 files changed

+121
-170
lines changed

11 files changed

+121
-170
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
cache: false
2424

2525
- name: golangci-lint
26-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
26+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
2727
with:
28-
version: v1.63
28+
version: v2.1

.golangci.yml

Lines changed: 97 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
---
1+
version: "2"
2+
run:
3+
allow-parallel-runners: true
24
linters:
3-
disable-all: true
5+
default: none
46
enable:
57
- asasalint
68
- asciicheck
79
- bidichk
810
- bodyclose
911
- canonicalheader
10-
# - copyloopvar // only on go1.22
12+
- copyloopvar
1113
- decorder
1214
- dogsled
1315
- durationcheck
1416
- errcheck
1517
- errchkjson
1618
- errname
17-
- copyloopvar
1819
- fatcontext
1920
- ginkgolinter
2021
- gocheckcompilerdirectives
@@ -23,20 +24,15 @@ linters:
2324
- gocritic
2425
- gocyclo
2526
- godox
26-
- gofmt
27-
- gofumpt
2827
- goheader
29-
- goimports
3028
- gomodguard
3129
- goprintffuncname
3230
- gosec
33-
- gosimple
3431
- gosmopolitan
3532
- govet
3633
- grouper
3734
- importas
3835
- ineffassign
39-
# - intrange // only on go1.22
4036
- loggercheck
4137
- makezero
4238
- mirror
@@ -57,151 +53,106 @@ linters:
5753
- spancheck
5854
- sqlclosecheck
5955
- staticcheck
60-
- stylecheck
6156
- tagalign
62-
- tenv
6357
- testableexamples
64-
- typecheck
6558
- unconvert
6659
- unparam
6760
- unused
6861
- usestdlibvars
6962
- wastedassign
7063
- whitespace
7164
- zerologlint
72-
# - containedctx
73-
# - cyclop
74-
# - depguard
75-
# - dupword
76-
# - err113
77-
# - errorlint
78-
# - exhaustive
79-
# - exhaustruct
80-
# - forbidigo
81-
# - forcetypeassert
82-
# - funlen
83-
# - gci
84-
# - gochecknoglobals
85-
# - gochecknoinits
86-
# - gocognit
87-
# - godot
88-
# - inamedparam
89-
# - interfacebloat
90-
# - ireturn
91-
# - lll
92-
# - maintidx
93-
# - mnd
94-
# - nestif
95-
# - nilerr
96-
# - nilnil
97-
# - nlreturn
98-
# - noctx
99-
# - nonamedreturns
100-
# - paralleltest
101-
# - tagliatelle
102-
# - testifylint
103-
# - testpackage
104-
# - thelper
105-
# - tparallel
106-
# - varnamelen
107-
# - wrapcheck
108-
# - wsl
109-
110-
linters-settings:
111-
importas:
112-
no-unaliased: true
113-
alias:
114-
# Kubernetes
115-
- pkg: k8s.io/api/core/v1
116-
alias: corev1
117-
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
118-
alias: apiextensionsv1
119-
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
120-
alias: metav1
121-
- pkg: k8s.io/apimachinery/pkg/api/errors
122-
alias: apierrors
123-
- pkg: k8s.io/apimachinery/pkg/util/errors
124-
alias: kerrors
125-
# Controller Runtime
126-
- pkg: sigs.k8s.io/controller-runtime
127-
alias: ctrl
128-
65+
settings:
66+
importas:
67+
alias:
68+
- pkg: k8s.io/api/core/v1
69+
alias: corev1
70+
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
71+
alias: apiextensionsv1
72+
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
73+
alias: metav1
74+
- pkg: k8s.io/apimachinery/pkg/api/errors
75+
alias: apierrors
76+
- pkg: k8s.io/apimachinery/pkg/util/errors
77+
alias: kerrors
78+
- pkg: sigs.k8s.io/controller-runtime
79+
alias: ctrl
80+
no-unaliased: true
81+
exclusions:
82+
generated: lax
83+
rules:
84+
- linters:
85+
- gosec
86+
text: 'G108: Profiling endpoint is automatically exposed on /debug/pprof'
87+
- linters:
88+
- gosec
89+
text: 'G115: integer overflow conversion int -> int32'
90+
- linters:
91+
- govet
92+
text: 'printf: non-constant format string in call to sigs.k8s.io/cluster-api/util/conditions.MarkFalse'
93+
- linters:
94+
- revive
95+
text: 'exported: exported method .*\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported'
96+
- linters:
97+
- errcheck
98+
text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
99+
- linters:
100+
- revive
101+
source: _ "embed"
102+
- linters:
103+
- revive
104+
text: exported (method|function|type|const) (.+) should have comment or be unexported
105+
source: (func|type).*Fake.*
106+
- linters:
107+
- revive
108+
path: fake_\.go
109+
text: exported (method|function|type|const) (.+) should have comment or be unexported
110+
- linters:
111+
- revive
112+
path: (framework|e2e|infrastructure/docker)/.*.go
113+
text: exported (method|function|type|const) (.+) should have comment or be unexported
114+
- linters:
115+
- unparam
116+
text: always receives
117+
- path: _test\.go
118+
text: should not use dot imports
119+
- path: (framework|e2e)/.*.go
120+
text: should not use dot imports
121+
- path: _test\.go
122+
text: cyclomatic complexity
123+
- linters:
124+
- gocritic
125+
text: 'appendAssign: append result not assigned to the same slice'
126+
- linters:
127+
- staticcheck
128+
text: 'SA1019: (s.GCPManagedControlPlane.Status.CurrentVersion|s.scope.GCPManagedControlPlane.Status.CurrentVersion|spec.ControlPlaneVersion|s.GCPManagedControlPlane.Spec.ControlPlaneVersion|s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion) is deprecated: This field will soon be removed and you are expected to use Version instead.'
129+
- path: (.+)\.go$
130+
text: Subprocess launch(ed with variable|ing should be audited)
131+
- path: (.+)\.go$
132+
text: (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
133+
- path: (.+)\.go$
134+
text: (G104|G307)
135+
paths:
136+
- zz_generated.*\.go$
137+
- .*conversion.*\.go$
138+
- mock*
139+
- third_party$
140+
- builtin$
141+
- examples$
129142
issues:
130-
max-same-issues: 0
131143
max-issues-per-linter: 0
132-
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant
133-
# changes in PRs and avoid nitpicking.
134-
exclude-use-default: false
135-
exclude-files:
136-
- "zz_generated.*\\.go$"
137-
- ".*conversion.*\\.go$"
138-
exclude-dirs:
139-
- mock*
140-
# List of regexps of issue texts to exclude, empty list by default.
141-
exclude:
142-
# The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
143-
# If it is decided they will not be addressed they should be moved above this comment.
144-
- Subprocess launch(ed with variable|ing should be audited)
145-
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
146-
- (G104|G307)
147-
exclude-rules:
148-
- linters:
149-
- gosec
150-
text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
151-
- linters:
152-
- gosec
153-
text: "G115: integer overflow conversion int -> int32"
154-
- linters:
155-
- govet
156-
text: "printf: non-constant format string in call to sigs.k8s.io/cluster-api/util/conditions.MarkFalse"
157-
- linters:
158-
- revive
159-
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
160-
- linters:
161-
- errcheck
162-
text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
163-
# With Go 1.16, the new embed directive can be used with an un-named import,
164-
# revive (previously, golint) only allows these to be imported in a main.go, which wouldn't work for us.
165-
# This directive allows the embed package to be imported with an underscore everywhere.
166-
- linters:
167-
- revive
168-
source: _ "embed"
169-
# Exclude some packages or code to require comments, for example test code, or fake clients.
170-
- linters:
171-
- revive
172-
text: exported (method|function|type|const) (.+) should have comment or be unexported
173-
source: (func|type).*Fake.*
174-
- linters:
175-
- revive
176-
text: exported (method|function|type|const) (.+) should have comment or be unexported
177-
path: fake_\.go
178-
- linters:
179-
- revive
180-
text: exported (method|function|type|const) (.+) should have comment or be unexported
181-
path: "(framework|e2e|infrastructure/docker)/.*.go"
182-
# Disable unparam "always receives" which might not be really
183-
# useful when building libraries.
184-
- linters:
185-
- unparam
186-
text: always receives
187-
# Dot imports for gomega or ginkgo are allowed
188-
# within test files.
189-
- path: _test\.go
190-
text: should not use dot imports
191-
- path: (framework|e2e)/.*.go
192-
text: should not use dot imports
193-
- path: _test\.go
194-
text: cyclomatic complexity
195-
# Append should be able to assign to a different var/slice.
196-
- linters:
197-
- gocritic
198-
text: "appendAssign: append result not assigned to the same slice"
199-
# Specific exclude rules for deprecated fields that are still part of the codebase.
200-
# These should be removed as the referenced deprecated item is removed from the project.
201-
- linters:
202-
- staticcheck
203-
text: "SA1019: (s.GCPManagedControlPlane.Status.CurrentVersion|s.scope.GCPManagedControlPlane.Status.CurrentVersion|spec.ControlPlaneVersion|s.GCPManagedControlPlane.Spec.ControlPlaneVersion|s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion) is deprecated: This field will soon be removed and you are expected to use Version instead."
204-
205-
run:
206-
timeout: 10m
207-
allow-parallel-runners: true
144+
max-same-issues: 0
145+
formatters:
146+
enable:
147+
- gofmt
148+
- gofumpt
149+
- goimports
150+
exclusions:
151+
generated: lax
152+
paths:
153+
- zz_generated.*\.go$
154+
- .*conversion.*\.go$
155+
- mock*
156+
- third_party$
157+
- builtin$
158+
- examples$

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Build the manager binary
16-
FROM golang:1.23.7@sha256:7fb9682dbc6c9743cd911cedb39c84790e8dfeaaf87d229b78f3f6658fce507a as builder
16+
FROM golang:1.23.9@sha256:1cc01afde44821895ea712b5b4b802ef3c3ddeb7a7bb3f2e69c19bbc5877dace as builder
1717
WORKDIR /workspace
1818

1919
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ENVSUBST_VER := v1.4.2
7474
ENVSUBST_BIN := envsubst
7575
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)
7676

77-
GOLANGCI_LINT_VER := v1.63.4
77+
GOLANGCI_LINT_VER := v2.1.6
7878
GOLANGCI_LINT_BIN := golangci-lint
7979
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
8080

cloud/scope/cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ func NewClusterScope(ctx context.Context, params ClusterScopeParams) (*ClusterSc
5050
return nil, errors.New("failed to generate new scope from nil GCPCluster")
5151
}
5252

53-
if params.GCPServices.Compute == nil {
53+
if params.Compute == nil {
5454
computeSvc, err := newComputeService(ctx, params.GCPCluster.Spec.CredentialsRef, params.Client, params.GCPCluster.Spec.ServiceEndpoints)
5555
if err != nil {
5656
return nil, errors.Errorf("failed to create gcp compute client: %v", err)
5757
}
5858

59-
params.GCPServices.Compute = computeSvc
59+
params.Compute = computeSvc
6060
}
6161

6262
helper, err := patch.NewHelper(params.GCPCluster, params.Client)

cloud/scope/managedcluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ func NewManagedClusterScope(ctx context.Context, params ManagedClusterScopeParam
5151
return nil, errors.New("failed to generate new scope from nil GCPManagedCluster")
5252
}
5353

54-
if params.GCPServices.Compute == nil {
54+
if params.Compute == nil {
5555
computeSvc, err := newComputeService(ctx, params.GCPManagedCluster.Spec.CredentialsRef, params.Client, params.GCPManagedCluster.Spec.ServiceEndpoints)
5656
if err != nil {
5757
return nil, errors.Errorf("failed to create gcp compute client: %v", err)
5858
}
5959

60-
params.GCPServices.Compute = computeSvc
60+
params.Compute = computeSvc
6161
}
6262

6363
helper, err := patch.NewHelper(params.GCPManagedCluster, params.Client)

0 commit comments

Comments
 (0)