task icon indicating copy to clipboard operation
task copied to clipboard

Invalid Go Version Format

Open Slates opened this issue 1 month ago • 4 comments

Description

We are using go task for our project, and when trying to upgrade to a new version are getting an error related to the go version declaration in the go.mod file:

go install github.com/go-task/task/v3/cmd/[email protected]

go: downloading github.com/go-task/task/v3 v3.39.2

go: github.com/go-task/task/v3/cmd/[email protected] (in github.com/go-task/task/[email protected]): go.mod:3: invalid go version '1.22.0': must match format 1.23

Seems like this is happening up until the latest version (just with 1.24.0 instead of 1.22.0 in the error). Wondering if anyone else has run into this.

Thanks

Version

v3.39.2

Operating system

Unix

Experiments Enabled

No response

Example Taskfile


Slates avatar Nov 13 '25 20:11 Slates

@Slates hi, you likely need to update your version of Go. Try 1.23 or 1.24

trulede avatar Nov 15 '25 16:11 trulede

@trulede Thanks for the response, I tried updating it and downgrading to versions between 1.23 and 1.24 in my project and in Jenkins and the error message stays constant.

Slates avatar Nov 18 '25 18:11 Slates

Worked for me, must be some factor at play. You could try clone the repo and install it with task install or via the install script (https://github.com/go-task/task/blob/v3.39.2/install-task.sh).

$ go install github.com/go-task/task/v3/cmd/[email protected]
$ task --version
Task version: v3.39.2 (h1:Zt7KXHmMNq5xWZ1ihphDb+n2zYLCo4BdRe09AnMMIgA=)
$ go version
go version go1.24.5 linux/amd64

trulede avatar Nov 18 '25 19:11 trulede

I can’t reproduce it either. This format has been allowed since Go 1.21, and go mod tidy produces it as well.

vmaerten avatar Nov 23 '25 21:11 vmaerten

The behaviour changed with v1.21 of go, so almost certainly you have (or had) an older version of Go installed. I'm fairly certain I have encountered the same problem, and resolved it by updating Go in our build containers/workspaces.

A go directive indicates that a module was written assuming the semantics of a given version of Go. The version must be a valid Go version, such as 1.14, 1.21rc1, or 1.23.0.

The go directive sets the minimum version of Go required to use this module. Before Go 1.21, the directive was advisory only; now it is a mandatory requirement: Go toolchains refuse to use modules declaring newer Go versions.

trulede avatar Dec 14 '25 10:12 trulede