Skip to content

Commit

Permalink
chore: upgrade go versions and fix ci test execution (#187)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fasmat committed Jul 10, 2024
1 parent 412e8ae commit 2c0a7fd
Show file tree
Hide file tree
Showing 16 changed files with 325 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.22.x

- name: Prepare release
run: |
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ on:
permissions:
contents: read

env:
GO111MODULE: on

jobs:
test:
strategy:
matrix:
go-version: [1.19.x, 1.20.x]
go-version: [1.19.x, 1.21.x, 1.22.x] # oldest version that can build go mock and official supported go versions
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 0 additions & 4 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

set -euo pipefail

if [[ $(go version) != *"go1.18"* ]]; then
exit 0
fi

for i in $(find $PWD -name go.mod); do
pushd $(dirname $i)
go mod tidy
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module go.uber.org/mock

go 1.20
go 1.19

require (
golang.org/x/mod v0.15.0
golang.org/x/tools v0.18.0
golang.org/x/mod v0.18.0
golang.org/x/tools v0.22.0
)

require github.com/yuin/goldmark v1.4.13 // indirect
9 changes: 5 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
8 changes: 4 additions & 4 deletions mockgen/internal/tests/generics/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module go.uber.org/mock/mockgen/internal/tests/generics

go 1.19

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

require (
go.uber.org/mock v1.6.0
golang.org/x/exp v0.0.0-20220428152302-39d4317da171
go.uber.org/mock v0.0.0-00010101000000-000000000000
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
)

replace go.uber.org/mock => ../../../..
4 changes: 2 additions & 2 deletions mockgen/internal/tests/generics/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 h1:TfdoLivD44QwvssI9Sv1xwa5DcL5XQr4au4sZ2F2NV4=
golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
25 changes: 25 additions & 0 deletions mockgen/internal/tests/generics/source/mock_external_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions mockgen/internal/tests/generics/source/mock_generics_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 24 additions & 14 deletions mockgen/internal/tests/typed/bugreport_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mockgen/internal/tests/typed/faux/faux.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ type Foreign interface {
error
}

type Embedded any
type Embedded interface{}

type Return any
type Return interface{}
4 changes: 2 additions & 2 deletions mockgen/internal/tests/typed/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module go.uber.org/mock/mockgen/internal/tests/typed

go 1.18
go 1.19

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

require (
go.uber.org/mock v0.0.0-00010101000000-000000000000
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
)
4 changes: 2 additions & 2 deletions mockgen/internal/tests/typed/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498 h1:TF0FvLUGEq/8wOt/9AV1nj6D4ViZGUIGCMQfCv7VRXY=
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498/go.mod h1:yh0Ynu2b5ZUe3MQfp2nM0ecK7wsgouWTDN0FNeJuIys=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
Loading

0 comments on commit 2c0a7fd

Please sign in to comment.