Skip to content

Commit ccfa81e

Browse files
unit tests: Fix the installation of tools
Install Go tools with new newest Go version before switching to the target version of Go to run the unit tests. This commit fixes an issue where the Go tools we use in unit tests can't be compiled with Go v1.14 any more.
1 parent 5dd227b commit ccfa81e

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

.github/workflows/unit.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,31 @@ jobs:
2020
GO111MODULE: "on"
2121

2222
steps:
23-
- name: Setup Go ${{ matrix.go-version }}
23+
- uses: actions/checkout@v3
24+
25+
- name: Setup Go v1
2426
uses: actions/setup-go@v4
2527
with:
26-
go-version: ${{ matrix.go-version }}
27-
28-
- uses: actions/checkout@v3
28+
go-version: 1
2929

30-
- name: Setup environment
30+
- name: Install tools
3131
run: |
32-
# Changing into a different directory to avoid polluting go.sum with "go get"
33-
cd "$(mktemp -d)"
34-
go mod init unit_tests
32+
go install github.com/wadey/gocovmerge@master
33+
go install golang.org/x/tools/cmd/goimports@latest
3534
36-
# we use "go get" for Go v1.14
37-
go install github.com/wadey/gocovmerge@master || go get github.com/wadey/gocovmerge
38-
go install golang.org/x/tools/cmd/goimports@latest || go get golang.org/x/tools/cmd/goimports@v0.8.0
35+
- if: ${{ matrix.go-version != '1' }}
36+
name: Setup Go ${{ matrix.go-version }}
37+
uses: actions/setup-go@v4
38+
with:
39+
go-version: ${{ matrix.go-version }}
3940

4041
- name: Run go vet
4142
run: |
4243
go vet ./...
4344
4445
- name: Run unit tests
4546
run: |
47+
go version
4648
./script/coverage
4749
./script/format
4850
./script/unittest -v

0 commit comments

Comments
 (0)