Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade go versions and fix ci test execution #187

Merged
merged 6 commits into from
Jul 10, 2024

Conversation

fasmat
Copy link
Contributor

@fasmat fasmat commented Jun 28, 2024

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 was a 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.

@fasmat
Copy link
Contributor Author

fasmat commented Jul 1, 2024

@r-hang do you have an feedback on this? 🙂

@r-hang
Copy link
Contributor

r-hang commented Jul 2, 2024

Hey @fasmat, I see some CI errors. I'm wondering if this has to do with the changes to the GO111MODULE flag. As for the test configuration, I think having CI tests for just the two latest versions of Go is sufficient.

Thank you for your contribution!

@fasmat
Copy link
Contributor Author

fasmat commented Jul 2, 2024

Hi @r-hang! I'm still trying to figure out why the one package fails to be parsed when executing the tests with newer go versions.

I don't think this is related to GO111MODULE. GO111MODULE=on has been the default since 1.13 if $PWD is outside $GOROOT and a go.mod file is found. Since 1.18 GO111MODULE has to be set to off to get the old behavior (before go install became an option) of go get.

Since this contribution: golang/mock#641 tests have only been executed for Go 1.18.x but not for other versions and since this contribution #6 the CI has been using Go 1.19.x and 1.20.x which means some PR merged after that broke the tests.

The package that fails the test was contributed in #11 and if I checkout that commit and run ./ci/tests.sh without the Go v1.18.x check it actually passes - so that narrows it down to some change between this PR and today that must have broken the test.

@fasmat
Copy link
Contributor Author

fasmat commented Jul 2, 2024

git bisect lead me to this PR: #48 before it was merged ./ci/test.sh passes. After that contribution it fails with

$ ./ci/test.sh 
/var/folders/4z/mx354sss66ndtlb135lfjnmc0000gn/T/tmp.Jhr9l4UvJI /var/folders/4z/mx354sss66ndtlb135lfjnmc0000gn/T/tmp.Jhr9l4UvJI
2024/07/02 20:16:53 Loading input failed: faux/faux.go:5:2: could not parse package faux: package faux is not in std (/opt/homebrew/Cellar/go/1.22.4/libexec/src/faux)
mockgen/internal/tests/aux_imports_embedded_interface/bugreport.go:3: running "mockgen": exit status 1
package command-line-arguments
        prog.go:14:2: use of internal package go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg not allowed

but it didn't show up in the CI because the tests were never executed. 🙁

@fasmat
Copy link
Contributor Author

fasmat commented Jul 7, 2024

@r-hang I identified and fixed the issue. Can you take another look? 🙂

@fasmat fasmat changed the title chore: upgrade go versions chore: upgrade go versions and fix ci test execution Jul 9, 2024
@fasmat
Copy link
Contributor Author

fasmat commented Jul 9, 2024

also ping @sywhang or @linzhp

@sywhang
Copy link
Contributor

sywhang commented Jul 9, 2024

Hi @fasmat , thanks for this PR and the ping! I will take a look at this either today or tomorrow.

Copy link
Contributor

@r-hang r-hang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Thank you so much!

Note: I landed https://github.com/uber-go/mock/pull/189/files which address the ISGOMOCK regeneration issue (this issue is also resolved in this diff) since that commit was created earlier than equivalent commit in this PR.

@r-hang r-hang merged commit 2c0a7fd into uber-go:main Jul 10, 2024
4 checks passed
@fasmat fasmat deleted the chore-update-go-version branch July 10, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants