| [gccgo] skip 'gccgo does not support -ldflags -X' | |
| go build -o linkx$GOEXE -ldflags -X=my.pkg.Text=linkXworked my.pkg/main | |
| exec ./linkx$GOEXE | |
| stderr '^linkXworked$' | |
| -- go.mod -- | |
| module my.pkg | |
| go 1.16 | |
| -- main/main.go -- | |
| package main | |
| import "my.pkg" | |
| func main() { | |
| println(pkg.Text) | |
| } | |
| -- pkg.go -- | |
| package pkg | |
| var Text = "unset" |