Skip to content

[release-0.9] Bump golangci-lint #2619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: release-0.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ linters:
- asciicheck
- bidichk
- bodyclose
# Commented out as this linter doesn't work against go 1.20 projects
# - copyloopvar
- cyclop
# - depguard
- dogsled
- dupword
- durationcheck
- errcheck
- exportloopref
- forbidigo
- gci
- goconst
Expand Down Expand Up @@ -56,7 +57,10 @@ linters-settings:
# TODO(sbuerin) fix remaining findings and set to 20 afterwards
max-complexity: 30
gci:
local-prefixes: sigs.k8s.io/cluster-api-provider-openstack
sections:
- standard
- default
- prefix(sigs.k8s.io/cluster-api-provider-openstack)
gocritic:
enabled-tags:
- diagnostic
Expand Down Expand Up @@ -129,10 +133,6 @@ linters-settings:
nolintlint:
# https://github.com/golangci/golangci-lint/issues/3228
allow-unused: true
staticcheck:
go: "1.20"
stylecheck:
go: "1.20"
nestif:
# minimal complexity of if statements to report, 5 by default
# TODO(sbuerin) fix remaining findings and set to 5 after:
Expand All @@ -157,8 +157,13 @@ issues:
- linters:
- revive
- stylecheck
path: (test)/.*.go
path: (.+)_test\.go|(test)/.*.go
text: should not use dot imports
- linters:
- revive
- stylecheck
path: (.+)_test\.go|(test)/.*.go
text: unused-parameter
- linters:
- revive
path: test/e2e/shared/defaults.go
Expand All @@ -171,12 +176,13 @@ issues:
- stylecheck
text: "ST1003: should not use underscores in Go names;"
path: .*(api|types)\/.*\/.*conversion.*\.go$
exclude-files:
- "zz_generated.*\\.go$"

run:
timeout: 10m
build-tags:
- e2e
go: "1.20"

skip-files:
- "zz_generated.*\\.go$"
allow-parallel-runners: true
1 change: 1 addition & 0 deletions controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ func reconcileNetworkComponents(scope scope.Scope, cluster *clusterv1.Cluster, o
// Set APIEndpoints so the Cluster API Cluster Controller can pull them
openStackCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
Host: host,
//nolint:gosec // disable G115
Port: int32(apiServerPort),
}
}
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ROOT_DIR_RELATIVE := ../..
include $(ROOT_DIR_RELATIVE)/common.mk

GOLANGCI_LINT_VERSION := v1.54.2
GOLANGCI_LINT_VERSION := v1.64.8

UNAME := $(shell uname -s)

Expand Down
1 change: 0 additions & 1 deletion pkg/cloud/services/networking/securitygroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (s *Service) ReconcileSecurityGroups(openStackCluster *infrav1.OpenStackClu
for k, desiredSecGroup := range desiredSecGroups {
var err error
observedSecGroups[k], err = s.getSecurityGroupByName(desiredSecGroup.Name)

if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions test/e2e/shared/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func executeCommand(ctx context.Context, p commandParameter) error {
return fmt.Errorf("unable to send command %q: %s", "sudo "+p.cmd.cmd, err)
}
result := strings.TrimSuffix(stdoutBuf.String(), "\n") + "\n" + strings.TrimSuffix(stderrBuf.String(), "\n")
//nolint:gosec // disable G306
if err := os.WriteFile(logFile, []byte(result), os.ModePerm); err != nil {
return fmt.Errorf("error writing log file: %s", err)
}
Expand Down