Skip to content

Commit

Permalink
feat(go): add Go 1.23 support (#396)
Browse files Browse the repository at this point in the history
Note: we need to set toolchain to auto just for installing tools. We want to keep the image default of local for CI and fail if a dependency tries to update the go version.

Ref: docker-library/golang#472
  • Loading branch information
codyoss authored Aug 14, 2024
1 parent a42269a commit e5ac456
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
28 changes: 14 additions & 14 deletions go/cloudbuild-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,36 @@

timeout: 7200s
steps:
# Go 1.20 build
# Go 1.21 build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/go119", "."]
dir: go/go120
id: go120-build
args: ["build", "-t", "gcr.io/$PROJECT_ID/go121", "."]
dir: go/go121
id: go121-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
[
"-i",
"gcr.io/$PROJECT_ID/go120",
"gcr.io/$PROJECT_ID/go121",
"--config",
"/workspace/go/go120.yaml",
"/workspace/go/go121.yaml",
"-v",
]
waitFor: ["go120-build"]
waitFor: ["go121-build"]

# Go 1.22 build
# Go 1.23 build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/go122", "."]
dir: go/go122
id: go122-build
args: ["build", "-t", "gcr.io/$PROJECT_ID/go123", "."]
dir: go/go123
id: go123-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
[
"-i",
"gcr.io/$PROJECT_ID/go122",
"gcr.io/$PROJECT_ID/go123",
"--config",
"/workspace/go/go122.yaml",
"/workspace/go/go123.yaml",
"-v",
]
waitFor: ["go122-build"]
waitFor: ["go123-build"]
32 changes: 16 additions & 16 deletions go/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,40 @@

timeout: 7200s # 2 hours
steps:
# Go 1.20 build
# Go 1.21 build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/go120", "."]
dir: go/go120
id: go120-build
args: ["build", "-t", "gcr.io/$PROJECT_ID/go121", "."]
dir: go/go121
id: go121-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
[
"-i",
"gcr.io/$PROJECT_ID/go120",
"gcr.io/$PROJECT_ID/go121",
"--config",
"/workspace/go/go120.yaml",
"/workspace/go/go121.yaml",
"-v",
]
waitFor: ["go120-build"]
waitFor: ["go121-build"]

# Go 1.22 build
# Go 1.23 build
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "gcr.io/$PROJECT_ID/go122", "."]
dir: go/go122
id: go122-build
args: ["build", "-t", "gcr.io/$PROJECT_ID/go123", "."]
dir: go/go123
id: go123-build
waitFor: ["-"]
- name: gcr.io/gcp-runtimes/structure_test
args:
[
"-i",
"gcr.io/$PROJECT_ID/go122",
"gcr.io/$PROJECT_ID/go123",
"--config",
"/workspace/go/go122.yaml",
"/workspace/go/go123.yaml",
"-v",
]
waitFor: ["go122-build"]
waitFor: ["go123-build"]

images:
- gcr.io/$PROJECT_ID/go120
- gcr.io/$PROJECT_ID/go122
- gcr.io/$PROJECT_ID/go121
- gcr.io/$PROJECT_ID/go123
2 changes: 1 addition & 1 deletion go/go121/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.c
apt-get install google-cloud-sdk -y

# Install tools used in build
RUN go install honnef.co/go/tools/cmd/staticcheck@latest && \
RUN GOTOOLCHAIN='auto' go install honnef.co/go/tools/cmd/staticcheck@latest && \
go install github.com/jstemmer/go-junit-report@latest && \
go install golang.org/x/lint/golint@latest && \
go install golang.org/x/tools/cmd/goimports@latest
Expand Down
2 changes: 1 addition & 1 deletion go/go122/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.c
apt-get install google-cloud-sdk -y

# Install tools used in build
RUN go install honnef.co/go/tools/cmd/staticcheck@latest && \
RUN GOTOOLCHAIN='auto' go install honnef.co/go/tools/cmd/staticcheck@latest && \
go install github.com/jstemmer/go-junit-report@latest && \
go install golang.org/x/lint/golint@latest && \
go install golang.org/x/tools/cmd/goimports@latest
Expand Down
4 changes: 2 additions & 2 deletions go/go120.yaml → go/go123.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@ schemaVersion: 1.0.0
commandTests:
- name: "version"
command: ["go", "version"]
expectedOutput: ["go version go1.20"]
expectedOutput: ["go version go1.23"]
- name: "gcloud"
command: ["gcloud", "version"]
expectedOutput: ["Google Cloud SDK"]
6 changes: 3 additions & 3 deletions go/go120/Dockerfile → go/go123/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.20
FROM golang:1.23

# Install dependencies
RUN set -ex; \
Expand Down Expand Up @@ -44,7 +44,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.c
apt-get install google-cloud-sdk -y

# Install tools used in build
RUN go install honnef.co/go/tools/cmd/staticcheck@latest && \
RUN GOTOOLCHAIN='auto' go install honnef.co/go/tools/cmd/staticcheck@latest && \
go install github.com/jstemmer/go-junit-report@latest && \
go install golang.org/x/lint/golint@latest && \
go install golang.org/x/tools/cmd/goimports@latest
Expand Down

0 comments on commit e5ac456

Please sign in to comment.