Skip to content

Commit

Permalink
Update to go 1.23 (#9312)
Browse files Browse the repository at this point in the history
* Bump controller-gen to v0.17.2 to be compatible with go 1.23
* Bump golang.org/x/crypto to v0.35.0
* Bump golangci-lint to v1.64.5 because of timeouts with newer go in
  older versions
  • Loading branch information
g-gaston authored Feb 27, 2025
1 parent d354e52 commit d1f266f
Show file tree
Hide file tree
Showing 39 changed files with 1,865 additions and 2,133 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.23'
check-latest: true
cache: true
- name: Run go test with coverage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.23"
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.2
version: v1.64.5
only-new-issues: true
args: --timeout 10m
4 changes: 2 additions & 2 deletions .github/workflows/vulnerability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jobs:
with:
check-latest: true
repo-checkout: false
go-version-file: go.mod
go-version-input: '1.23'
- name: govulncheck for release module
uses: golang/govulncheck-action@v1
with:
check-latest: true
repo-checkout: false
cache: false # cache will be already setup by previous step
work-dir: release/cli
go-version-input: '1.22'
go-version-input: '1.23'
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ SHELL := /bin/bash
ARTIFACTS_BUCKET?=my-s3-bucket
GIT_VERSION?=$(shell git describe --tag)
GIT_TAG?=$(shell git tag -l "v*.*.*" --sort -v:refname | head -1)
GOLANG_VERSION?="1.21"
GO_PATH?= $(shell source ./scripts/common.sh && build::common::get_go_path $(GOLANG_VERSION))
GOLANG_VERSION?="1.23"
GO_PATH ?= $(shell source ./scripts/common.sh && build::common::get_go_path $(GOLANG_VERSION))
GO ?= $(GO_PATH)/go
GO_TEST ?= $(GO) test
# A regular expression defining what packages to exclude from the unit-test recipe.
Expand Down Expand Up @@ -112,6 +112,7 @@ BUILD_LIB := build/lib
BUILDKIT := $(BUILD_LIB)/buildkit.sh

CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN_VERSION := v0.17.2
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)

GO_VULNCHECK_BIN := govulncheck
Expand Down Expand Up @@ -299,7 +300,7 @@ $(KUBEBUILDER): $(TOOLS_BIN_DIR)
chmod +x $(KUBEBUILDER)

$(CONTROLLER_GEN): $(TOOLS_BIN_DIR)
GOBIN=$(TOOLS_BIN_DIR_ABS) $(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0
GOBIN=$(TOOLS_BIN_DIR_ABS) $(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION)

$(GO_VULNCHECK): $(TOOLS_BIN_DIR)
GOBIN=$(TOOLS_BIN_DIR_ABS) $(GO) install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down Expand Up @@ -448,12 +449,18 @@ endif
rm -rf _output
make -C docs clean

#
# Generate zz_generated.deepcopy.go
#
## We need to make sure the right go binary is used when running controller-gen.
## Among other things it uses the go binary to parse the go.mod, which due to newer directives,
## has to be parsed with a version at least as new as the go version used to build the go.mod.
## In a local dev environment this export path is not necessary, assuming single go version is used.
## However, in CI we use the base builder image which contains multiple go versions and might not default to
## the same version as the one in this Makefile.
generate: export PATH := $(GO_PATH):$(PATH)
generate: $(CONTROLLER_GEN) ## Generate zz_generated.deepcopy.go
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" \
paths=./pkg/api/... \
paths="./release/api/..."

.PHONY: verify-generate
verify-generate: generate ## Verify if generated zz_generated.deepcopy.go files need to be updated
$(eval DIFF=$(shell git diff --raw -- '*.go' | wc -c))
Expand Down Expand Up @@ -731,6 +738,13 @@ generate-manifests: ## Generate manifests e.g. CRD, RBAC etc.
$(MAKE) generate-core-manifests

.PHONY: generate-core-manifests
## We need to make sure the right go binary is used when running controller-gen.
## Among other things it uses the go binary to parse the go.mod, which due to newer directives,
## has to be parsed with a version at least as new as the go version used to build the go.mod.
## In a local dev environment this export path is not necessary, assuming single go version is used.
## However, in CI we use the base builder image which contains multiple go versions and might not default to
## the same version as the one in this Makefile.
generate-core-manifests: export PATH := $(GO_PATH):$(PATH)
generate-core-manifests: $(CONTROLLER_GEN) ## Generate manifests for the core provider e.g. CRD, RBAC etc.
$(CONTROLLER_GEN) \
paths=./pkg/api/... \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.17.2
name: awsdatacenterconfigs.anywhere.eks.amazonaws.com
spec:
group: anywhere.eks.amazonaws.com
Expand All @@ -22,14 +21,19 @@ spec:
API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand All @@ -52,9 +56,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
31 changes: 15 additions & 16 deletions config/crd/bases/anywhere.eks.amazonaws.com_awsiamconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.17.2
name: awsiamconfigs.anywhere.eks.amazonaws.com
spec:
group: anywhere.eks.amazonaws.com
Expand All @@ -21,14 +20,19 @@ spec:
description: AWSIamConfig is the Schema for the awsiamconfigs API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand All @@ -39,8 +43,9 @@ spec:
description: AWSRegion defines a region in an AWS partition
type: string
backendMode:
description: BackendMode defines multiple backends for aws-iam-authenticator
server The server searches for mappings in order
description: |-
BackendMode defines multiple backends for aws-iam-authenticator server
The server searches for mappings in order
items:
type: string
type: array
Expand Down Expand Up @@ -97,9 +102,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit d1f266f

Please sign in to comment.