You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directive was added to `go.mod` with Go 1.21[1] So that this
directive can be highlighted in `go.mod`.
It's not entirely clear exactly what the fully supported syntax is. The
docs[1] suggests any Go release version, e.g.
* `go1.20`
* `go1.21.1`
* `go1.21.1rc1`
`golang.org/x/mod` gives a much more relaxed definition, requiring just
that things match against the regex `^default$|^go1($|\.)`[2]
Finally there's `FromToolchain` from the stdlib's internals for
processing versions[3] which is broader than that from[1] but more
limited than that from[2], supporting arbitrary suffixes (after any of
`" \t-"`) appended to the version, e.g.
* go1.21.3-somesuffix
* go1.21rc2-somesuffix
* go1.21 some-suffix
The approach taken for the syntax matching here is closest to this final
condition, and will not include some toolchain verison's that would be
supported by the `modfile` regex, e.g.
* go1.21.1blah
* go1.21!some-suffix
Since these would be rejected by the `go` tool itself with an error like
> go: invalid toolchain "go1.21.1blah" in go.mod
0 commit comments