Text file src/cmd/go/testdata/script/build_link_x_import_path_escape.txt
1 [compiler:gccgo] skip 'gccgo does not support -ldflags -X' 2 3 go build -o linkx$GOEXE -ldflags -X=my.pkg.Text=linkXworked my.pkg/main 4 exec ./linkx$GOEXE 5 stderr '^linkXworked$' 6 7 -- go.mod -- 8 module my.pkg 9 10 go 1.16 11 -- main/main.go -- 12 package main 13 14 import "my.pkg" 15 16 func main() { 17 println(pkg.Text) 18 } 19 -- pkg.go -- 20 package pkg 21 22 var Text = "unset" 23