Skip to content

Commit

Permalink
Merge pull request #10153 from sbueringer/release-1.5-go-1.21
Browse files Browse the repository at this point in the history
[release-1.5] 🌱 Bump Go to 1.21.5
  • Loading branch information
k8s-ci-robot authored Feb 15, 2024
2 parents 7c4d3b1 + dca1937 commit 785ffa4
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # tag=v3.6.0
with:
version: v1.53.3
version: v1.55.2
working-directory: ${{matrix.working-directory}}
11 changes: 9 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 10m
go: "1.20"
go: "1.21"
build-tags:
- tools
- e2e
Expand Down Expand Up @@ -211,7 +211,8 @@ linters-settings:
#
- name: bool-literal-in-expr
- name: constant-logical-expr

goconst:
ignore-tests: true
issues:
max-same-issues: 0
max-issues-per-linter: 0
Expand Down Expand Up @@ -323,3 +324,9 @@ issues:
- gocritic
text: "deferInLoop: Possible resource leak, 'defer' is called in the 'for' loop"
path: _test\.go
# Note: We only found issues with memory aliasing after backporting Go 1.21 and a new golangci-lint version.
# Let's not waste time fixing memory aliasing in unit tests on this branch.
- linters:
- gosec
text: "G601: Implicit memory aliasing in for loop"
path: _test\.go
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SHELL:=/usr/bin/env bash
#
# Go.
#
GO_VERSION ?= 1.20.12
GO_VERSION ?= 1.21.5
GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION)

# Use GOPROXY environment variable if set
Expand Down
6 changes: 3 additions & 3 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ def load_provider_tiltfiles():

tilt_helper_dockerfile_header = """
# Tilt image
FROM golang:1.20.12 as tilt-helper
FROM golang:1.21.5 as tilt-helper
# Install delve. Note this should be kept in step with the Go release minor version.
RUN go install github.com/go-delve/delve/cmd/dlv@v1.20
RUN go install github.com/go-delve/delve/cmd/dlv@v1.21
# Support live reloading with Tilt
RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/tilt-dev/rerun-process-wrapper/master/restart.sh && \
wget --output-document /start.sh --quiet https://raw.githubusercontent.com/tilt-dev/rerun-process-wrapper/master/start.sh && \
Expand All @@ -195,7 +195,7 @@ RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com
"""

tilt_dockerfile_header = """
FROM golang:1.20.12 as tilt
FROM golang:1.21.5 as tilt
WORKDIR /
COPY --from=tilt-helper /process.txt .
COPY --from=tilt-helper /start.sh .
Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterctl/client/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func (c *clusterctlClient) Move(options MoveOptions) error {
return c.toDirectory(options)
} else if options.FromDirectory != "" {
return c.fromDirectory(options)
} else {
return c.move(options)
}

return c.move(options)
}

func (c *clusterctlClient) move(options MoveOptions) error {
Expand Down
2 changes: 1 addition & 1 deletion exp/runtime/hooks/api/v1alpha1/discovery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func init() {
"Runtime Extension implementers must use this hook to inform the Cluster API runtime about all the handlers " +
"that are defined in an external component implementing Runtime Extensions.\n" +
"\n" +
"Notes:\n" +
"Notes:\n" + //nolint:goconst
"- When using Runtime SDK utils, a handler for this hook is automatically generated",
Singleton: true,
})
Expand Down
2 changes: 1 addition & 1 deletion exp/runtime/hooks/api/v1alpha1/lifecyclehooks_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func init() {
"all the objects which are part of a Cluster's topology are going to be created.\n" +
"\n" +
"Notes:\n" +
"- This hook will be called only for Clusters with a managed topology\n" +
"- This hook will be called only for Clusters with a managed topology\n" + //nolint:goconst
"- The call's request contains the Cluster object\n" +
"- This is a blocking hook; Runtime Extension implementers can use this hook to execute\n" +
"tasks before the objects which are part of a Cluster's topology are created",
Expand Down
2 changes: 1 addition & 1 deletion hack/ensure-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ EOF
local go_version
IFS=" " read -ra go_version <<< "$(go version)"
local minimum_go_version
minimum_go_version=go1.20
minimum_go_version=go1.21
if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
cat <<EOF
Detected go version: ${go_version[*]}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ func (r *Reconciler) getMachineDeploymentsForMachineSet(ctx context.Context, ms
}

deployments := make([]*clusterv1.MachineDeployment, 0, len(dList.Items))
for idx, d := range dList.Items {
selector, err := metav1.LabelSelectorAsSelector(&d.Spec.Selector)
for idx := range dList.Items {
selector, err := metav1.LabelSelectorAsSelector(&dList.Items[idx].Spec.Selector)
if err != nil {
continue
}
Expand Down
3 changes: 2 additions & 1 deletion internal/topology/check/compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ func ClusterClassReferencesAreValid(clusterClass *clusterv1.ClusterClass) field.
allErrs = append(allErrs, LocalObjectTemplateIsValid(clusterClass.Spec.ControlPlane.MachineInfrastructure, clusterClass.Namespace, field.NewPath("spec", "controlPlane", "machineInfrastructure"))...)
}

for i, mdc := range clusterClass.Spec.Workers.MachineDeployments {
for i := range clusterClass.Spec.Workers.MachineDeployments {
mdc := clusterClass.Spec.Workers.MachineDeployments[i]
allErrs = append(allErrs, LocalObjectTemplateIsValid(&mdc.Template.Bootstrap, clusterClass.Namespace,
field.NewPath("spec", "workers", "machineDeployments").Index(i).Child("template", "bootstrap"))...)
allErrs = append(allErrs, LocalObjectTemplateIsValid(&mdc.Template.Infrastructure, clusterClass.Namespace,
Expand Down
3 changes: 2 additions & 1 deletion internal/webhooks/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust
}

if cluster.Spec.Topology.Workers != nil {
for i, md := range cluster.Spec.Topology.Workers.MachineDeployments {
for i := range cluster.Spec.Topology.Workers.MachineDeployments {
md := cluster.Spec.Topology.Workers.MachineDeployments[i]
if md.MachineHealthCheck != nil {
fldPath := field.NewPath("spec", "topology", "workers", "machineDeployments", "machineHealthCheck").Index(i)

Expand Down
3 changes: 2 additions & 1 deletion test/framework/machinedeployment_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ func AssertMachineDeploymentFailureDomains(ctx context.Context, input AssertMach
return input.Lister.List(ctx, ms, client.InNamespace(input.Cluster.Namespace), client.MatchingLabels(selectorMap))
}, retryableOperationTimeout, retryableOperationInterval).Should(Succeed(), "Failed to list MachineSets for Cluster %s", klog.KObj(input.Cluster))

for _, machineSet := range ms.Items {
for i := range ms.Items {
machineSet := ms.Items[i]
machineSetFD := pointer.StringDeref(machineSet.Spec.Template.Spec.FailureDomain, "<None>")
Expect(machineSetFD).To(Equal(machineDeploymentFD), "MachineSet %s is in the %q failure domain, expecting %q", machineSet.Name, machineSetFD, machineDeploymentFD)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func TestReconcileNormalEtcd(t *testing.T) {

manager := cmanager.New(scheme)

host := "127.0.0.1" //nolint:goconst
host := "127.0.0.1"
wcmux, err := server.NewWorkloadClustersMux(manager, host, server.CustomPorts{
// NOTE: make sure to use ports different than other tests, so we can run tests in parallel
MinPort: server.DefaultMinPort + 1000,
Expand Down
2 changes: 1 addition & 1 deletion test/infrastructure/inmemory/internal/server/mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestMux(t *testing.T) {
manager := cmanager.New(scheme)

wcl := "workload-cluster"
host := "127.0.0.1" //nolint:goconst
host := "127.0.0.1"
wcmux, err := NewWorkloadClustersMux(manager, host, CustomPorts{
// NOTE: make sure to use ports different than other tests, so we can run tests in parallel
MinPort: DefaultMinPort,
Expand Down
4 changes: 2 additions & 2 deletions util/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func (v buildIdentifiers) compare(o buildIdentifiers) int {
return 0
} else if i == len(v) && i < len(o) {
return -1
} else {
return 1
}

return 1
}

type buildIdentifier struct {
Expand Down

0 comments on commit 785ffa4

Please sign in to comment.