Todays article is about how to get passed this error. So, I was trying to setup a GitHub workflow (golangci-lint and tests) for a project I am working on and then this error came up.
The above error is as a result of the go version in your go.mod
file. Which apparently should look like this 1.x.x
but the GitHub actions you are trying to setup wants it to be in this format 1.x
The way to solve this problem is to update the go version in your go.mod file to be 1.21
instead of 1.21.4
. Also, note that if any of your GitHub actions is running the command go tidy
in anyway, then you will need to reduce the go version in your go.mod file because the maximum version supported by the go tidy is 1.20
else you'll get another kind of error similar to maximum version supported by the go tidy is 1.20
for that particular Github action.
Generally, when you get this error, just update your go version from this format 1.x.x
to 1.x
and you should be good.
Do have a wonderful day ;).
Top comments (4)
go mod tidy
and golangci-lint works in every version? curious what GH action you are using onThis is the GitHub actions I was trying to run. For some reasons, on this line
run: cd src && go get && go mod tidy && go test ./...
it returned an maximum go version supported bygo mod tidy
and after updating the go version everything works as they should.sh
some of the GH actions look like in older versions, I would recommend updating them then also pls do not mutate the state of go.mod via go get during a CI/CD phase. Anything that runs go test or go build automatically does
go mod download
if vendor file is not created specifically viago mod vendor
, you don't really need to run go get or go mod tidy in any of these casesThanks boss.