Skip to content
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

✨ Add support for go 1.22 #3910

Merged
merged 1 commit into from
May 16, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "~1.21"
go-version: "~1.22"
- name: Execute go-apidiff
uses: joelanford/go-apidiff@v0.8.2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Remove pre-installed kustomize
run: sudo rm -f /usr/local/bin/kustomize
- name: Run make test for project-v4-with-deploy-image
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Clone the code
uses: actions/checkout@v4
- name: Run linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Clone the code
uses: actions/checkout@v4
- name: Run linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sample-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'

- name: Create kind cluster
run: kind create cluster
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Remove pre-installed kustomize
# This step is needed as the following one tries to remove
# kustomize for each test but has no permission to do so
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
# This step is needed as the following one tries to remove
# kustomize for each test but has no permission to do so
- name: Remove pre-installed kustomize
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- name: Generate the coverage output
run: make test-coverage
- name: Send the coverage output
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Please see https://git.k8s.io/community/CLA.md for more info.

## Prerequisites

- [go](https://golang.org/dl/) version v1.21+.
- [go](https://golang.org/dl/) version v1.22+.
- [docker](https://docs.docker.com/install/) version 17.03+.
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) version v1.11.3+.
- [kustomize](https://github.com/kubernetes-sigs/kustomize/blob/master/site/content/en/docs/Getting%20started/installation.md) v3.1.0+
Expand Down
4 changes: 2 additions & 2 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ command = "./litgo.sh"
command = "./markerdocs.sh"

[context.environment]
environment = { GO_VERSION = "1.21" }
environment = { GO_VERSION = "1.22" }

[context.deploy-preview.environment]
environment = { GO_VERSION = "1.21" }
environment = { GO_VERSION = "1.22" }

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tutorial.kubebuilder.io/project

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tutorial.kubebuilder.io/project

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting-started/testdata/project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting-started/testdata/project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting-started/testdata/project/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module example.com/memcached

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tutorial.kubebuilder.io/project

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module v1

go 1.21
go 1.22

require (
github.com/spf13/pflag v1.0.5
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/v3

go 1.21
go 1.22

require (
github.com/gobuffalo/flect v1.0.2
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/golang/go_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ var _ = Describe("checkGoVersion", func() {
Entry("for go.1.19.1", "go1.19.1"),
Entry("for go.1.20", "go1.20"),
Entry("for go.1.21", "go1.21"),
Entry("for go.1.22", "go1.22"),
)

DescribeTable("should return an error for non-supported go versions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (f *Dockerfile) SetTemplateDefaults() error {
}

const dockerfileTemplate = `# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (f *GoMod) SetTemplateDefaults() error {

const goModTemplate = `module {{ .Repo }}

go 1.21
go 1.22

require (
sigs.k8s.io/controller-runtime {{ .ControllerRuntimeVersion }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const readmeFileTemplate = `# {{ .ProjectName }}
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-multigroup-with-deploy-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-multigroup-with-deploy-image/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup-with-deploy-image

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-multigroup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-multigroup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-multigroup/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v4-multigroup

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-deploy-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-deploy-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-deploy-image/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v4-with-deploy-image

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-grafana/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4-with-grafana/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v4-with-grafana

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Getting Started

### Prerequisites
- go version v1.21.0+
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v4/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v4

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.14.0
Expand Down
Loading