Skip to content

Commit 84f6d2a

Browse files
vatsalparekhtomleb
andauthored
[release/v0.6] Upgrade go version to 1.23 (#585)
* Upgrade go version to 1.23 Signed-off-by: Vatsal Parekh <[email protected]> * Update golangci-lint to v1.63.4 for Go 1.23 support * Add codegen fix for Go 1.23 support --------- Signed-off-by: Vatsal Parekh <[email protected]> Co-authored-by: Tom Lebreux <[email protected]>
1 parent 638b624 commit 84f6d2a

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

Dockerfile.dapper

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.suse.com/bci/golang:1.22
1+
FROM registry.suse.com/bci/golang:1.23
22

33
ARG DAPPER_HOST_ARCH
44
ENV ARCH $DAPPER_HOST_ARCH
@@ -11,7 +11,7 @@ RUN zypper -n install git docker vim less file curl wget awk
1111
RUN curl -sL https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz | tar xvzf - -C /usr/local/bin --strip-components=1
1212

1313
RUN if [ "${ARCH}" = "amd64" ]; then \
14-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.1; \
14+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.63.4; \
1515
helm plugin install https://github.com/helm-unittest/helm-unittest.git --version ${HELM_UNITTEST_VERSION}>/out.txt 2>&1; \
1616
fi
1717

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/rancher/webhook
22

3-
go 1.22.0
3+
go 1.23.0
44

5-
toolchain go1.22.7
5+
toolchain go1.23.4
66

77
replace (
88
github.com/rancher/rke => github.com/rancher/rke v1.6.2

pkg/codegen/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Turn off creation of Alias types, which break code generation.
2+
// This can be removed after migrating to k8s 1.32 code generators that are aware of the new type.
3+
// For more details see https://github.com/rancher/rancher/issues/47207
4+
//go:debug gotypesalias=0
5+
16
package main
27

38
import (

pkg/resources/common/psa-validation.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ var psaLabels = []string{
2323

2424
// IsUpdatingPSAConfig will indicate whether or not the labels being passed in
2525
// are attempting to update PSA-related configuration.
26-
func IsUpdatingPSAConfig(old map[string]string, new map[string]string) bool {
26+
func IsUpdatingPSAConfig(oldLabels map[string]string, newLabels map[string]string) bool {
2727
for _, label := range psaLabels {
28-
if old[label] != new[label] {
28+
if oldLabels[label] != newLabels[label] {
2929
return true
3030
}
3131
}
@@ -34,8 +34,8 @@ func IsUpdatingPSAConfig(old map[string]string, new map[string]string) bool {
3434

3535
// IsCreatingPSAConfig will indicate whether or not the labels being passed in
3636
// are attempting to create PSA-related configuration.
37-
func IsCreatingPSAConfig(new map[string]string) bool {
38-
for label := range new {
37+
func IsCreatingPSAConfig(newLabels map[string]string) bool {
38+
for label := range newLabels {
3939
if slices.Contains(psaLabels, label) {
4040
return true
4141
}

pkg/resources/management.cattle.io/v3/feature/validator.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,20 @@ func (a *admitter) Admit(request *admission.Request) (*admissionv1.AdmissionResp
8888

8989
// isUpdateAllowed checks that the new value does not change on spec unless it's equal to the lockedValue,
9090
// or lockedValue is nil.
91-
func isUpdateAllowed(old, new *v3.Feature) bool {
92-
if old == nil || new == nil {
91+
func isUpdateAllowed(oldFeature, newFeature *v3.Feature) bool {
92+
if oldFeature == nil || newFeature == nil {
9393
return false
9494
}
95-
if new.Status.LockedValue == nil {
95+
if newFeature.Status.LockedValue == nil {
9696
return true
9797
}
98-
if old.Spec.Value == nil && new.Spec.Value == nil {
98+
if oldFeature.Spec.Value == nil && newFeature.Spec.Value == nil {
9999
return true
100100
}
101-
if old.Spec.Value != nil && new.Spec.Value != nil && *old.Spec.Value == *new.Spec.Value {
101+
if oldFeature.Spec.Value != nil && newFeature.Spec.Value != nil && *oldFeature.Spec.Value == *newFeature.Spec.Value {
102102
return true
103103
}
104-
if new.Spec.Value != nil && *new.Spec.Value == *new.Status.LockedValue {
104+
if newFeature.Spec.Value != nil && *newFeature.Spec.Value == *newFeature.Status.LockedValue {
105105
return true
106106
}
107107
return false

0 commit comments

Comments
 (0)