blob: daa544d3f053a5d878b308e63cfbf761e992eebc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[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$'
-- my.pkg/main/main.go --
package main
import "my.pkg"
func main() {
println(pkg.Text)
}
-- my.pkg/pkg.go --
package pkg
var Text = "unset"
|