Skip to content

Commit

Permalink
Add go-version file to control exact version of Go
Browse files Browse the repository at this point in the history
It was found that the build steps were actually downloading an older
version of Go 1.17 and not the expected latest version. This changes
adds a go-version file for explicitly setting the version to be used for
test builds. The circle configuration has been updated to set the go
version as an environment variable before executing any install
commands.
  • Loading branch information
nywilken committed Aug 8, 2022
1 parent 7b479a3 commit 7528b89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
19 changes: 7 additions & 12 deletions .circleci/config.yml
Expand Up @@ -15,27 +15,24 @@ executors:
resource_class: medium+
darwin:
macos:
xcode: "13.4.0"
xcode: "13.4.1"

commands:
install-go-run-tests-unix:
parameters:
GOOS:
type: string
GOVERSION:
type: string
steps:
- checkout
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.<< parameters.GOOS >>-amd64.tar.gz | tar -C ~/ -xz
- run: export GOVERSION=$(cat .go-version)
- run: curl https://dl.google.com/go/go${GOVERSION}.<< parameters.GOOS >>-amd64.tar.gz | tar -C ~/ -xz
- run: GO111MODULE=on PATH="$PATH:$HOME/go/bin/" ~/go/bin/go test ./... -race -coverprofile=coverage.txt -covermode=atomic
install-go-run-tests-windows:
parameters:
GOVERSION:
type: string
steps:
- checkout
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.windows-amd64.zip --output ~/go<< parameters.GOVERSION >>.windows-amd64.zip
- run: unzip ~/go<< parameters.GOVERSION >>.windows-amd64.zip -d ~/
- run: export GOVERSION=$(cat .go-version)
- run: curl https://dl.google.com/go/go${GOVERSION}.windows-amd64.zip --output ~/go${GOVERSION}.windows-amd64.zip
- run: unzip ~/go${GOVERSION}.windows-amd64.zip -d ~/
- run: GO111MODULE=on PATH="$PATH:$HOME/go/bin/" ~/go/bin/go test ./... -coverprofile=coverage.txt -covermode=atomic

# Golang CircleCI 2.0 configuration file
Expand All @@ -58,14 +55,12 @@ jobs:
steps:
- install-go-run-tests-unix:
GOOS: darwin
GOVERSION: "1.17"
test-windows:
executor:
name: win/vs2019
shell: bash.exe
steps:
- install-go-run-tests-windows:
GOVERSION: "1.17"
- install-go-run-tests-windows
check-lint:
executor: golang
resource_class: xlarge
Expand Down
1 change: 1 addition & 0 deletions .go-version
@@ -0,0 +1 @@
1.17.13

0 comments on commit 7528b89

Please sign in to comment.