chore(go): upgrading to 1.24 (#766)

* chore(go): upgrading to 1.24

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* chore(ci): building golanci-lint from source

* chore(golangci-lint): aligning to v2 release

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

---------

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
This commit is contained in:
Dario Tranchitella
2025-04-01 21:09:46 +02:00
committed by GitHub
parent 0f3de13d26
commit b2ec531183
9 changed files with 84 additions and 59 deletions

View File

@@ -25,11 +25,13 @@ jobs:
with:
go-version-file: go.mod
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.5.2
with:
version: v1.62.2
only-new-issues: false
args: --config .golangci.yml
run: make golint
# TODO(prometherion): enable back once golangci-lint is built from v1.24 rather than v1.23
# uses: golangci/golangci-lint-action@v6.5.2
# with:
# version: v1.62.2
# only-new-issues: false
# args: --config .golangci.yml
diff:
name: diff
runs-on: ubuntu-22.04

View File

@@ -1,53 +1,76 @@
run:
timeout: 10m
linters-settings:
revive:
rules:
- name: dot-imports
arguments:
- allowedPackages:
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"
gci:
sections:
- standard
- default
- prefix(github.com/clastix/kamaji/)
goheader:
template: |-
Copyright 2022 Clastix Labs
SPDX-License-Identifier: Apache-2.0
version: "2"
linters:
default: all
disable:
- depguard
- wrapcheck
- mnd
- varnamelen
- testpackage
- tagliatelle
- paralleltest
- ireturn
- err113
- gochecknoglobals
- wsl
- exhaustive
- nosprintfhostport
- nonamedreturns
- interfacebloat
- exhaustruct
- lll
- gosec
- gomoddirectives
- godox
- gochecknoinits
- funlen
- dupl
- cyclop
- depguard
- dupl
- err113
- exhaustive
- exhaustruct
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- godox
- gomoddirectives
- gosec
- interfacebloat
- ireturn
- lll
- mnd
- nestif
- nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
# deprecated linters
- exportloopref
enable-all: true
- tagliatelle
- testpackage
- varnamelen
- wrapcheck
- wsl
settings:
staticcheck:
checks:
- all
- -QF1008
goheader:
template: |-
Copyright 2022 Clastix Labs
SPDX-License-Identifier: Apache-2.0
revive:
rules:
- name: dot-imports
arguments:
- allowedPackages:
- github.com/onsi/ginkgo/v2
- github.com/onsi/gomega
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/clastix/kamaji/)
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@@ -103,7 +103,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
.PHONY: apidocs-gen
apidocs-gen: $(APIDOCS_GEN) ## Download crdoc locally if necessary.

View File

@@ -19,7 +19,7 @@ var _ = Describe("Cluster controller", func() {
)
BeforeEach(func() {
ctx = context.Background() //nolint:fatcontext
ctx = context.Background()
tcp = &TenantControlPlane{
ObjectMeta: metav1.ObjectMeta{
Name: "tcp",

View File

@@ -19,7 +19,7 @@ var _ = Describe("Datastores validation test", func() {
)
BeforeEach(func() {
ctx = context.Background() //nolint:fatcontext
ctx = context.Background()
ds = &DataStore{
ObjectMeta: metav1.ObjectMeta{
Name: "ds",

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/clastix/kamaji
go 1.23.0
go 1.24
require (
github.com/JamesStewy/go-mysqldump v0.2.2

View File

@@ -28,7 +28,7 @@ var _ = Describe("DatastoreStorageConfig", func() {
)
BeforeEach(func() {
ctx = context.Background() //nolint:fatcontext
ctx = context.Background()
tcp = &kamajiv1alpha1.TenantControlPlane{
ObjectMeta: metav1.ObjectMeta{

View File

@@ -42,7 +42,7 @@ var _ = Describe("TCP Defaulting Webhook", func() {
},
},
}
ctx = context.Background() //nolint:fatcontext
ctx = context.Background()
})
Describe("fields missing", func() {

View File

@@ -31,7 +31,7 @@ var _ = Describe("TCP LoadBalancer Source Ranges Webhook", func() {
},
Spec: kamajiv1alpha1.TenantControlPlaneSpec{},
}
ctx = context.Background() //nolint:fatcontext
ctx = context.Background()
})
It("allows creation when valid CIDR ranges are provided", func() {