Skip to content

Commit

Permalink
Repo controlled Go version
Browse files Browse the repository at this point in the history
Signed-off-by: xdu31 <jasonxdu@amazon.com>
  • Loading branch information
xdu31 committed Mar 6, 2024
1 parent 8868454 commit c17c9fe
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/go.coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '~1.21.0'
go-version: ${{ env.GO_VERSION }}
id: go

- name: Build
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/go.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '~1.21.0'
go-version: ${{ env.GO_VERSION }}
id: go

- name: Build
Expand All @@ -33,10 +36,13 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '~1.21.0'
go-version: ${{ env.GO_VERSION }}
id: go

- name: Build
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: '~1.21.0'
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/make.doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21.0'
go-version: ${{ env.GO_VERSION }}

- name: Update Docs
run: |
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.21.7
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ BUILDOPTS?=-v
GOPATH?=$(HOME)/go
MAKEPWD:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
CGO_ENABLED?=0
GOLANG_VERSION ?= $(shell cat .go-version)

export GOSUMDB = sum.golang.org
export GOTOOLCHAIN = go$(GOLANG_VERSION)

.PHONY: all
all: coredns
Expand Down
4 changes: 4 additions & 0 deletions Makefile.release
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ NAME:=coredns
VERSION:=$(shell grep 'CoreVersion' coremain/version.go | awk '{ print $$3 }' | tr -d '"')
GITHUB:=coredns
LINUX_ARCH:=amd64 arm arm64 mips64le ppc64le s390x mips riscv64
GOLANG_VERSION ?= $(shell cat .go-version)

export GOSUMDB = sum.golang.org
export GOTOOLCHAIN = go$(GOLANG_VERSION)

all:
@echo Use the 'release' target to build a release
Expand Down

0 comments on commit c17c9fe

Please sign in to comment.