...

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

Documentation: cmd/go/testdata/script

     1# Test for issue #68658: In GOPATH mode, files with a //go:build fileVersion
     2# earlier than go1.21 should downgrade to go1.21 and no further.
     3
     4[short] skip 'requires build'
     5
     6env GO111MODULE=off
     7go build foo bar
     8
     9-- foo/main.go --
    10//go:build go1.10
    11
    12package p
    13
    14import "fmt"
    15
    16func main() {
    17	var x any  // any was added in Go 1.18
    18	fmt.Println(x)
    19}
    20
    21-- bar/main.go --
    22//go:build go1.20
    23
    24package p
    25
    26import "fmt"
    27
    28func main() {
    29    y := max(1, 2)  // max was added in Go 1.21
    30    fmt.Println(y)
    31}

View as plain text