Skip to content

Commit f629ebd

Browse files
committed
fix: bumps golangci-lint to work with go 1.24+
1 parent ea774f5 commit f629ebd

File tree

8 files changed

+34
-12
lines changed

8 files changed

+34
-12
lines changed

.github/workflows/pr-golangci-lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
pull_request:
55
types: [opened, edited, synchronize, reopened]
66

7-
# Remove all permissions from GITHUB_TOKEN except metadata.
8-
permissions: {}
7+
permissions:
8+
contents: read # Required for actions/checkout
99

1010
jobs:
1111
golangci:
@@ -28,7 +28,7 @@ jobs:
2828
- name: golangci-lint
2929
uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # tag=v9.0.0
3030
with:
31-
version: v2.1.0
31+
version: v2.5.0
3232
working-directory: ${{matrix.working-directory}}
3333
- name: Lint API
3434
run: make lint-api

.golangci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,26 @@ linters:
297297
path: .*(api|types|test)\/.*\/.*conversion.*\.go$
298298
# This rule warns when initialism, variable or package naming conventions are not followed.
299299
text: "var-naming: don't use underscores in Go names"
300+
- linters:
301+
- revive
302+
path: 'exp/utils/*'
303+
text: 'var-naming: avoid meaningless package names'
304+
- linters:
305+
- revive
306+
path: 'cmd/clusterawsadm/cmd/ami/common'
307+
text: 'var-naming: avoid meaningless package names'
308+
- linters:
309+
- revive
310+
path: 'cmd/clusterawsadm/cmd/util'
311+
text: 'var-naming: avoid meaningless package names'
312+
- linters:
313+
- revive
314+
path: 'pkg/utils'
315+
text: 'var-naming: avoid meaningless package names'
316+
- linters:
317+
- revive
318+
path: 'pkg/cloud/services/common/'
319+
text: 'var-naming: avoid meaningless package names'
300320
- linters:
301321
- unparam
302322
text: always receives

hack/tools/.custom-gcl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: v2.1.0
1+
version: v2.4.0
22
name: golangci-lint-kube-api-linter
33
destination: ./bin
44
plugins:

test/e2e/shared/aws.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ func ensureTestImageUploaded(ctx context.Context, e2eCtx *E2EContext) error {
764764
return err
765765
}
766766

767-
cmd := exec.Command("docker", "inspect", "--format='{{index .Id}}'", "gcr.io/k8s-staging-cluster-api/capa-manager:e2e")
767+
cmd := exec.CommandContext(ctx, "docker", "inspect", "--format='{{index .Id}}'", "gcr.io/k8s-staging-cluster-api/capa-manager:e2e")
768768
var stdOut bytes.Buffer
769769
cmd.Stdout = &stdOut
770770
err := cmd.Run()
@@ -775,7 +775,7 @@ func ensureTestImageUploaded(ctx context.Context, e2eCtx *E2EContext) error {
775775
imageSha := strings.ReplaceAll(strings.TrimSuffix(stdOut.String(), "\n"), "'", "")
776776

777777
ecrImageName := repoName + ":e2e"
778-
cmd = exec.Command("docker", "tag", imageSha, ecrImageName) //nolint:gosec
778+
cmd = exec.CommandContext(ctx, "docker", "tag", imageSha, ecrImageName) //nolint:gosec
779779
err = cmd.Run()
780780
if err != nil {
781781
return err
@@ -794,13 +794,13 @@ func ensureTestImageUploaded(ctx context.Context, e2eCtx *E2EContext) error {
794794
return errors.New("failed to decode ECR authentication token")
795795
}
796796

797-
cmd = exec.Command("docker", "login", "--username", strList[0], "--password", strList[1], "public.ecr.aws") //nolint:gosec
797+
cmd = exec.CommandContext(ctx, "docker", "login", "--username", strList[0], "--password", strList[1], "public.ecr.aws") //nolint:gosec
798798
err = cmd.Run()
799799
if err != nil {
800800
return err
801801
}
802802

803-
cmd = exec.Command("docker", "push", ecrImageName)
803+
cmd = exec.CommandContext(ctx, "docker", "push", ecrImageName)
804804
err = cmd.Run()
805805
if err != nil {
806806
return err

test/e2e/shared/suite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
8989
templateDir := path.Join(e2eCtx.Settings.ArtifactFolder, "templates")
9090
newTemplatePath := templateDir + "/" + ciTemplateForUpgradeName
9191

92-
err = exec.Command("cp", ciTemplateForUpgradePath, newTemplatePath).Run() //nolint:gosec
92+
err = exec.CommandContext(context.TODO(), "cp", ciTemplateForUpgradePath, newTemplatePath).Run() //nolint:gosec
9393
Expect(err).NotTo(HaveOccurred())
9494

9595
clusterctlCITemplateForUpgrade := clusterctl.Files{

test/helpers/envtest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ func (t *TestEnvironment) WaitForWebhooks() {
271271
timeout := 1 * time.Second
272272
for {
273273
time.Sleep(1 * time.Second)
274-
conn, err := net.DialTimeout("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(port)), timeout)
274+
dialer := &net.Dialer{Timeout: timeout}
275+
conn, err := dialer.DialContext(context.Background(), "tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(port)))
275276
if err != nil {
276277
klog.V(2).Infof("Webhook port is not ready, will retry in %v: %s", timeout, err)
277278
continue

test/helpers/kubernetesversions/template.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package kubernetesversions
2222

2323
import (
2424
"bytes"
25+
"context"
2526
_ "embed"
2627
"errors"
2728
"fmt"
@@ -128,7 +129,7 @@ func GenerateCIArtifactsInjectedTemplateForDebian(input GenerateCIArtifactsInjec
128129
if err := os.WriteFile(path.Join(overlayDir, "platform-kustomization.yaml"), input.PlatformKustomization, 0o600); err != nil {
129130
return "", err
130131
}
131-
cmd := exec.Command("kustomize", "build", overlayDir) //nolint:gosec // We don't care about command injection here.
132+
cmd := exec.CommandContext(context.TODO(), "kustomize", "build", overlayDir) //nolint:gosec // We don't care about command injection here.
132133
data, err := cmd.CombinedOutput()
133134
if err != nil {
134135
return "", err

versions.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ CERT_MANAGER_VERSION := v1.17.2
1818
CAPI_VERSION := v1.11.1
1919
KPROMO_VERSION := v4.0.5
2020
YQ_VERSION := v4.25.2
21-
GOLANGCI_LINT_VERSION := v2.1.0
21+
GOLANGCI_LINT_VERSION := v2.5.0
2222
RELEASE_NOTES_VERSION := v0.16.5
2323
GORELEASER_VERSION := v1.24.0

0 commit comments

Comments
 (0)