Skip to content

Commit 2c0a7fd

Browse files
authored
chore: upgrade go versions and fix ci test execution (#187)
I updated the CI to use the two newest stable versions of go (v1.21.x and v1.22.x) to test the code as well as the oldest version (`v1.19.x`) that could still be used to build the source. The behaviour of the `go version` line in `go.mod` changed with `v1.21.x`: it should state the oldest version of go that is needed to build the source. The source builds and tests fine with `v1.19.x`, older versions however fail, so I set it to this version. Before my changes the `test` GH workflow didn't actually execute `./ci/test.sh` because there is was check that skipped testing if the used go version was any other than `1.18`. I removed this check which showed some tests failing even without my changes. The issue turned out to have been introduced by accident (because tests weren't executed) in #48. The fix for it can be found in commit 0403497 (part of this PR). Additionally I had to regenerate all mocks or `./ci/tests.sh` would complain that they weren't up to date.
1 parent 412e8ae commit 2c0a7fd

File tree

16 files changed

+325
-269
lines changed

16 files changed

+325
-269
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup Go
2121
uses: actions/setup-go@v4
2222
with:
23-
go-version: 1.20.x
23+
go-version: 1.22.x
2424

2525
- name: Prepare release
2626
run: |

.github/workflows/test.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ on:
88
permissions:
99
contents: read
1010

11-
env:
12-
GO111MODULE: on
13-
1411
jobs:
1512
test:
1613
strategy:
1714
matrix:
18-
go-version: [1.19.x, 1.20.x]
15+
go-version: [1.19.x, 1.21.x, 1.22.x] # oldest version that can build go mock and official supported go versions
1916
os: [ubuntu-latest]
2017
runs-on: ${{ matrix.os }}
2118
steps:

ci/test.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
set -euo pipefail
55

6-
if [[ $(go version) != *"go1.18"* ]]; then
7-
exit 0
8-
fi
9-
106
for i in $(find $PWD -name go.mod); do
117
pushd $(dirname $i)
128
go mod tidy

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module go.uber.org/mock
22

3-
go 1.20
3+
go 1.19
44

55
require (
6-
golang.org/x/mod v0.15.0
7-
golang.org/x/tools v0.18.0
6+
golang.org/x/mod v0.18.0
7+
golang.org/x/tools v0.22.0
88
)
99

1010
require github.com/yuin/goldmark v1.4.13 // indirect

go.sum

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
22
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
3-
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
4-
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
5-
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
6-
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
3+
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
4+
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
5+
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
6+
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
7+
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=

mockgen/internal/tests/generics/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module go.uber.org/mock/mockgen/internal/tests/generics
22

33
go 1.19
44

5+
replace go.uber.org/mock => ../../../..
6+
57
require (
6-
go.uber.org/mock v1.6.0
7-
golang.org/x/exp v0.0.0-20220428152302-39d4317da171
8+
go.uber.org/mock v0.0.0-00010101000000-000000000000
9+
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
810
)
9-
10-
replace go.uber.org/mock => ../../../..
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 h1:TfdoLivD44QwvssI9Sv1xwa5DcL5XQr4au4sZ2F2NV4=
2-
golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
1+
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
2+
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=

mockgen/internal/tests/generics/source/mock_external_mock.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mockgen/internal/tests/generics/source/mock_generics_mock.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mockgen/internal/tests/typed/bugreport_mock.go

Lines changed: 24 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mockgen/internal/tests/typed/faux/faux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ type Foreign interface {
66
error
77
}
88

9-
type Embedded any
9+
type Embedded interface{}
1010

11-
type Return any
11+
type Return interface{}

mockgen/internal/tests/typed/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module go.uber.org/mock/mockgen/internal/tests/typed
22

3-
go 1.18
3+
go 1.19
44

55
replace go.uber.org/mock => ../../../..
66

77
require (
88
go.uber.org/mock v0.0.0-00010101000000-000000000000
9-
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498
9+
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
1010
)

mockgen/internal/tests/typed/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498 h1:TF0FvLUGEq/8wOt/9AV1nj6D4ViZGUIGCMQfCv7VRXY=
2-
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498/go.mod h1:yh0Ynu2b5ZUe3MQfp2nM0ecK7wsgouWTDN0FNeJuIys=
1+
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
2+
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=

0 commit comments

Comments
 (0)