Skip to content

Commit b68a68d

Browse files
xdu31yash97
authored andcommitted
Repo controlled build go version (#381)
1 parent 9a65750 commit b68a68d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.github/workflows/presubmit.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ jobs:
4343
steps:
4444
- name: Checkout
4545
uses: actions/checkout@v3
46+
- name: Setup Go Version
47+
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
4648
- uses: actions/setup-go@v4
4749
with:
48-
go-version: '1.21.5'
50+
go-version: ${{ env.GO_VERSION }}
4951
cache-dependency-path: "**/go.sum"
5052
- name: Install `govulncheck`
5153
run: go install golang.org/x/vuln/cmd/govulncheck@latest

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.21.5

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))
1212
VERSION ?= $(GIT_VERSION)
1313
IMAGE ?= $(REPO):$(VERSION)
1414
BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:latest.2
15-
BUILD_IMAGE ?= public.ecr.aws/bitnami/golang:1.21.5
15+
GOLANG_VERSION ?= $(shell cat .go-version)
16+
BUILD_IMAGE ?= public.ecr.aws/bitnami/golang:$(GOLANG_VERSION)
1617
GOARCH ?= amd64
1718
PLATFORM ?= linux/amd64
1819

20+
export GOSUMDB = sum.golang.org
21+
export GOTOOLCHAIN = go$(GOLANG_VERSION)
22+
1923
help: ## Display help
2024
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
2125

0 commit comments

Comments
 (0)