Skip to content

Commit 6645335

Browse files
Upgrade GolangCI-Lint to Latest Version (v2.0.2)
1 parent 5307272 commit 6645335

File tree

61 files changed

+149
-155
lines changed

Some content is hidden

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

61 files changed

+149
-155
lines changed

.github/workflows/lint-sample.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636
working-directory: ${{ matrix.folder }}
3737
run: make lint-config
3838
- name: Run linter
39-
uses: golangci/golangci-lint-action@v6
39+
uses: golangci/golangci-lint-action@v7
4040
with:
41-
version: v1.63.4
41+
version: v2.0.2
4242
working-directory: ${{ matrix.folder }}
4343
args: --config .golangci.yml ./...
4444
- name: Run linter via makefile target

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
- name: Check linter configuration
2525
run: make lint-config
2626
- name: Run linter
27-
uses: golangci/golangci-lint-action@v6
27+
uses: golangci/golangci-lint-action@v7
2828
with:
29-
version: v1.63.4
29+
version: v2.0.2
3030

3131
yamllint:
3232
runs-on: ubuntu-latest

.golangci.yml

+7-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
version: 2
12
run:
23
timeout: 5m
34
allow-parallel-runners: true
45

56
issues:
6-
# don't skip warning about doc comments
7-
# don't exclude the default set of lint
87
exclude-use-default: false
9-
# restore some of the defaults
10-
# (fill in the rest as needed)
118
exclude-rules:
129
- linters: [gosec]
1310
path: "test/e2e/*"
@@ -26,13 +23,11 @@ linters-settings:
2623
allow-unused: false
2724
revive:
2825
rules:
29-
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
3026
- name: blank-imports
3127
- name: context-as-argument
3228
- name: context-keys-type
3329
- name: dot-imports
3430
arguments:
35-
# dot import should be ONLY allowed for ginkgo testing packages
3631
- allowedPackages:
3732
- "github.com/onsi/ginkgo/v2"
3833
- "github.com/onsi/gomega"
@@ -45,7 +40,7 @@ linters-settings:
4540
- name: var-naming
4641
- name: var-declaration
4742
- name: package-comments
48-
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings.
43+
disabled: true
4944
- name: range
5045
- name: receiver-naming
5146
- name: time-naming
@@ -57,9 +52,6 @@ linters-settings:
5752
- name: unused-parameter
5853
- name: unreachable-code
5954
- name: redefines-builtin-id
60-
#
61-
# Rules in addition to the recommended configuration above.
62-
#
6355
- name: bool-literal-in-expr
6456
- name: constant-logical-expr
6557
- name: comment-spacings
@@ -73,9 +65,7 @@ linters:
7365
- ginkgolinter
7466
- goconst
7567
- gocyclo
76-
- gofmt
77-
- goimports
78-
- gosimple
68+
- gofumpt
7969
- govet
8070
- ineffassign
8171
- lll
@@ -85,8 +75,11 @@ linters:
8575
- prealloc
8676
- revive
8777
- staticcheck
88-
- typecheck
8978
- unconvert
9079
- unparam
9180
- unused
9281

82+
formatters:
83+
enable:
84+
- gofmt
85+
- goimports

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
125125
golangci-lint:
126126
@[ -f $(GOLANGCI_LINT) ] || { \
127127
set -e ;\
128-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.63.4 ;\
128+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v2.0.2 ;\
129129
}
130130

131131
.PHONY: apidiff

docs/book/src/cronjob-tutorial/testdata/emptycontroller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"k8s.io/apimachinery/pkg/runtime"
2929
ctrl "sigs.k8s.io/controller-runtime"
3030
"sigs.k8s.io/controller-runtime/pkg/client"
31-
"sigs.k8s.io/controller-runtime/pkg/log"
31+
logf "sigs.k8s.io/controller-runtime/pkg/log"
3232

3333
batchv1 "tutorial.kubebuilder.io/project/api/v1"
3434
)
@@ -88,7 +88,7 @@ some pairs at the top of our reconcile method to have those attached to all log
8888
lines in this reconciler.
8989
*/
9090
func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
91-
_ = log.FromContext(ctx)
91+
_ = logf.FromContext(ctx)
9292

9393
// your logic here
9494

docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v6
2222
with:
23-
version: v1.63.4
23+
version: v2.0.2

docs/book/src/cronjob-tutorial/testdata/project/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.17.2
182182
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
183183
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
184184
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
185-
GOLANGCI_LINT_VERSION ?= v1.63.4
185+
GOLANGCI_LINT_VERSION ?= v2.0.2
186186

187187
.PHONY: kustomize
188188
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -210,7 +210,7 @@ $(ENVTEST): $(LOCALBIN)
210210
.PHONY: golangci-lint
211211
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
212212
$(GOLANGCI_LINT): $(LOCALBIN)
213-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
213+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
214214

215215
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
216216
# $1 - target path with name of binary

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
ref "k8s.io/client-go/tools/reference"
3737
ctrl "sigs.k8s.io/controller-runtime"
3838
"sigs.k8s.io/controller-runtime/pkg/client"
39-
"sigs.k8s.io/controller-runtime/pkg/log"
39+
logf "sigs.k8s.io/controller-runtime/pkg/log"
4040

4141
batchv1 "tutorial.kubebuilder.io/project/api/v1"
4242
)
@@ -98,7 +98,7 @@ var (
9898
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile
9999
// nolint:gocyclo
100100
func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
101-
log := log.FromContext(ctx)
101+
log := logf.FromContext(ctx)
102102

103103
/*
104104
### 1: Load the CronJob by name

docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v6
2222
with:
23-
version: v1.63.4
23+
version: v2.0.2

docs/book/src/getting-started/testdata/project/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.17.2
178178
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
179179
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
180180
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
181-
GOLANGCI_LINT_VERSION ?= v1.63.4
181+
GOLANGCI_LINT_VERSION ?= v2.0.2
182182

183183
.PHONY: kustomize
184184
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -206,7 +206,7 @@ $(ENVTEST): $(LOCALBIN)
206206
.PHONY: golangci-lint
207207
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
208208
$(GOLANGCI_LINT): $(LOCALBIN)
209-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
209+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
210210

211211
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
212212
# $1 - target path with name of binary

docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"k8s.io/apimachinery/pkg/runtime"
3434
ctrl "sigs.k8s.io/controller-runtime"
3535
"sigs.k8s.io/controller-runtime/pkg/client"
36-
"sigs.k8s.io/controller-runtime/pkg/log"
36+
logf "sigs.k8s.io/controller-runtime/pkg/log"
3737

3838
cachev1alpha1 "example.com/memcached/api/v1alpha1"
3939
)
@@ -71,7 +71,7 @@ type MemcachedReconciler struct {
7171
// For more details, check Reconcile and its Result here:
7272
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile
7373
func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
74-
log := log.FromContext(ctx)
74+
log := logf.FromContext(ctx)
7575

7676
// Fetch the Memcached instance
7777
// The purpose is check if the Custom Resource for the Kind Memcached

docs/book/src/multiversion-tutorial/testdata/project/.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- name: Run linter
2121
uses: golangci/golangci-lint-action@v6
2222
with:
23-
version: v1.63.4
23+
version: v2.0.2

docs/book/src/multiversion-tutorial/testdata/project/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.17.2
182182
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
183183
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
184184
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
185-
GOLANGCI_LINT_VERSION ?= v1.63.4
185+
GOLANGCI_LINT_VERSION ?= v2.0.2
186186

187187
.PHONY: kustomize
188188
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -210,7 +210,7 @@ $(ENVTEST): $(LOCALBIN)
210210
.PHONY: golangci-lint
211211
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
212212
$(GOLANGCI_LINT): $(LOCALBIN)
213-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
213+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
214214

215215
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
216216
# $1 - target path with name of binary

docs/book/src/multiversion-tutorial/testdata/project/internal/controller/cronjob_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
ref "k8s.io/client-go/tools/reference"
3737
ctrl "sigs.k8s.io/controller-runtime"
3838
"sigs.k8s.io/controller-runtime/pkg/client"
39-
"sigs.k8s.io/controller-runtime/pkg/log"
39+
logf "sigs.k8s.io/controller-runtime/pkg/log"
4040

4141
batchv1 "tutorial.kubebuilder.io/project/api/v1"
4242
)
@@ -98,7 +98,7 @@ var (
9898
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile
9999
// nolint:gocyclo
100100
func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
101-
log := log.FromContext(ctx)
101+
log := logf.FromContext(ctx)
102102

103103
/*
104104
### 1: Load the CronJob by name

docs/book/src/reference/watching-resources/secondary-owned-resources.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ is scaled back to 1 replica.
8080
```go
8181
// Reconcile handles the main reconciliation loop for Busybox and the Deployment
8282
func (r *BusyboxReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
83-
log := log.FromContext(ctx)
83+
log := logf.FromContext(ctx)
8484

8585
// Fetch the Busybox instance
8686
busybox := &examplecomv1alpha1.Busybox{}

docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin/v1/go.mod

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ godebug default=go1.23
66

77
require (
88
github.com/spf13/pflag v1.0.6
9-
sigs.k8s.io/kubebuilder/v4 v4.5.1
9+
sigs.k8s.io/kubebuilder/v4 v4.5.2
1010
)
1111

1212
require (
1313
github.com/gobuffalo/flect v1.0.3 // indirect
14-
github.com/spf13/afero v1.12.0 // indirect
15-
golang.org/x/mod v0.23.0 // indirect
16-
golang.org/x/sync v0.11.0 // indirect
17-
golang.org/x/text v0.22.0 // indirect
18-
golang.org/x/tools v0.30.0 // indirect
14+
github.com/spf13/afero v1.14.0 // indirect
15+
golang.org/x/mod v0.24.0 // indirect
16+
golang.org/x/sync v0.12.0 // indirect
17+
golang.org/x/text v0.23.0 // indirect
18+
golang.org/x/tools v0.31.0 // indirect
1919
)

docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin/v1/go.sum

+22-22
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
88
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
99
github.com/gobuffalo/flect v1.0.3 h1:xeWBM2nui+qnVvNM4S3foBhCAL2XgPU+a7FdpelbTq4=
1010
github.com/gobuffalo/flect v1.0.3/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs=
11-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
12-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
11+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
12+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
1313
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
1414
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
15-
github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU=
16-
github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk=
17-
github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8=
18-
github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY=
15+
github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0=
16+
github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM=
17+
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
18+
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
1919
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2020
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
2121
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
22-
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
23-
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
22+
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
23+
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
2424
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
2525
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
2626
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -31,23 +31,23 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
3131
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
3232
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
3333
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
34-
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
35-
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
36-
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
37-
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
38-
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
39-
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
40-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
41-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
42-
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
43-
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
44-
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
45-
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
34+
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
35+
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
36+
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
37+
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
38+
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
39+
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
40+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
41+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
42+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
43+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
44+
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
45+
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
4646
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4747
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4848
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4949
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
50-
sigs.k8s.io/kubebuilder/v4 v4.5.1 h1:gn00jQu3gtk80u3rcy2IUgz1XZ1aziMNRl4c7DMukEg=
51-
sigs.k8s.io/kubebuilder/v4 v4.5.1/go.mod h1:GwFRe37LVgPpUPFecaBkaUxrVtsyQ2bJmoze4zxupcI=
50+
sigs.k8s.io/kubebuilder/v4 v4.5.2 h1:57lmVU1zwjOZAF28hBhZyaxE6qXreHYekI4yt/Q5rEU=
51+
sigs.k8s.io/kubebuilder/v4 v4.5.2/go.mod h1:oJrPYf8hkfLCh2vb40vD/Gm22CJsFHlGQz1mw2ZiQaY=
5252
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
5353
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

hack/docs/internal/cronjob-tutorial/controller_implementation.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const controllerImport = `import (
3838
ref "k8s.io/client-go/tools/reference"
3939
ctrl "sigs.k8s.io/controller-runtime"
4040
"sigs.k8s.io/controller-runtime/pkg/client"
41-
"sigs.k8s.io/controller-runtime/pkg/log"
41+
logf "sigs.k8s.io/controller-runtime/pkg/log"
4242
4343
batchv1 "tutorial.kubebuilder.io/project/api/v1"
4444
)
@@ -87,7 +87,7 @@ var (
8787
const skipGoCycloLint = `
8888
// nolint:gocyclo`
8989

90-
const controllerReconcileLogic = `log := log.FromContext(ctx)
90+
const controllerReconcileLogic = `log := logf.FromContext(ctx)
9191
9292
/*
9393
### 1: Load the CronJob by name

hack/docs/internal/cronjob-tutorial/generate_cronjob.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (sp *Sample) updateController() {
263263
"k8s.io/apimachinery/pkg/runtime"
264264
ctrl "sigs.k8s.io/controller-runtime"
265265
"sigs.k8s.io/controller-runtime/pkg/client"
266-
"sigs.k8s.io/controller-runtime/pkg/log"
266+
logf "sigs.k8s.io/controller-runtime/pkg/log"
267267
268268
batchv1 "tutorial.kubebuilder.io/project/api/v1"
269269
)`, controllerImport)
@@ -293,7 +293,7 @@ func (sp *Sample) updateController() {
293293

294294
err = pluginutil.ReplaceInFile(
295295
filepath.Join(sp.ctx.Dir, "internal/controller/cronjob_controller.go"),
296-
` _ = log.FromContext(ctx)
296+
` _ = logf.FromContext(ctx)
297297
298298
// TODO(user): your logic here
299299

hack/docs/internal/getting-started/generate_getting_started.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ func (sp *Sample) updateController() {
165165

166166
err = pluginutil.ReplaceInFile(
167167
filepath.Join(sp.ctx.Dir, pathFile),
168-
"_ = log.FromContext(ctx)",
169-
"log := log.FromContext(ctx)",
168+
"_ = logf.FromContext(ctx)",
169+
"log := logf.FromContext(ctx)",
170170
)
171171
hackutils.CheckError("add log var", err)
172172

0 commit comments

Comments
 (0)