-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
go env GOVERSION
says it prints runtime.Version
, and that API is documented as:
// buildVersion is the Go tree's version string at build time.
//
// If any GOEXPERIMENTs are set to non-default values, it will include
// "X:<GOEXPERIMENT>".
//
// This is set by the linker.
//
// This is accessed by "go version <binary>".
var buildVersion string
// Version returns the Go tree's version string.
// It is either the commit hash and date at the time of the build or,
// when possible, a release tag like "go1.3".
func Version() string {
return buildVersion
}
So, for example, GOEXPERIMENT=nodwarf5 ./make.bash
leads to something like:
$ go env GOVERSION
go1.25.3 X:nodwarf5
Similarly, when running tip, one can end up with a "devel" version like:
$ go env GOVERSION
go1.26-devel_36863d6194 2025-10-17 01:07:59 -0700
However, the X:
suffix form is not supported by go/version
; as of 36863d6, the program
package main
import "go/version"
func main() {
println(version.IsValid("go1.25.3"))
println(version.IsValid("go1.26-devel_36863d6194 2025-10-17 01:07:59 -0700"))
println(version.IsValid("go1.25.3 X:nodwarf5"))
}
prints
true
true
false
My understanding is that go env GOVERSION
should be parseable by go/version
at all times, as long as Go was built in the usual way without a custom version string in a VERSION file at build time.
dmitshur and qmuntal
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.