Up front, I have to admit that I'm struggling with the newly introduced download-your-go-toolchain-on-the-fly when it comes to:
- having reproducible builds in a CI/CD pipeline without getting downloaded a different toolchain as installed at the stage start,
- being a module maintained as opposed to being a "leaf" app maintainer without downstream users, while maintaining the N,N-1 go (minor) version guarantee.
What happens is when I'm on a go 1.21.x toolchain in order to ensure the N,N-1 guarantee, a go-mod-upgrade on a module with a
k8s.io/api "crashes" with the following error, caused by the go command used from go-mod-upgrade under its hood:
Error running go command to discover modules: exit status 1 stderr=go: loading module retractions for k8s.io/a...@v0.26.2: module k8s.io/a...@v0.30.0 requires go >= 1.22.0 (running go 1.21.7; GOTOOLCHAIN=local)
Is there a way in the go command to upgrade to the "latest" dependency that doesn't trigger this error?
Manually, I can see that there is a 0.29.4 available. Unfortunately, even a single dependency like this causes go-mod-upgrade to fail completely, so it's back for me to maintaining each and ever of my many deps individually ... which absolutely sucks from the UX perspective as I'm sure you can follow along with. Remember, I simply cannot switch toolchains on a whim, not least due to CI/CD policies.
How to deal with this situation? Is there a way to use the go tool so that it would return only upgrades without toolchain changes? How might the go-mod-upgrade tool work around this situation?