...

Text file src/cmd/go/testdata/script/version_goexperiment.txt

Documentation: cmd/go/testdata/script

     1# Test that experiments appear in "go version <binary>"
     2
     3# This test requires rebuilding the runtime, which takes a while.
     4[short] skip
     5
     6env GOEXPERIMENT=fieldtrack
     7go build -o main$GOEXE version.go
     8go version main$GOEXE
     9stdout 'X:fieldtrack$'
    10exec ./main$GOEXE
    11stderr 'X:fieldtrack$'
    12
    13-- version.go --
    14package main
    15import (
    16	"go/version"
    17	"runtime"
    18)
    19func main() {
    20	if !version.IsValid(runtime.Version()) {
    21		panic("version not valid: "+runtime.Version())
    22	}
    23	println(runtime.Version())
    24}

View as plain text