You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import"fmt"varbuildTimestringfuncmain() {
fmt.Println(buildTime)
}
$ go build -ldflags "-X main.buildTime \"$(date -u)\""
# _/tmp/bar
link: warning: option -X main.buildTime Fri Aug 14 19:50:25 UTC 2015 may not work in future releases; use -X main.buildTime=Fri Aug 14 19:50:25 UTC 2015
-x output:
/usr/local/Cellar/go/1.5rc1/libexec/pkg/tool/darwin_amd64/link -o $WORK/_/tmp/bar/_obj/exe/a.out -L $WORK -extld=clang -buildmode=exe -buildid=1583c81ada6eb4c112c3f8767eea388203667aa3 -X main.buildTime "Fri Aug 14 19:51:24 UTC 2015" $WORK/_/tmp/bar.a
$ go build -ldflags "-X main.buildTime=\"$(date -u)\""
# _/tmp/bar
usage: link [options] main.o
...
-x output:
/usr/local/Cellar/go/1.5rc1/libexec/pkg/tool/darwin_amd64/link -o $WORK/_/tmp/bar/_obj/exe/a.out -L $WORK -extld=clang -buildmode=exe -buildid=1583c81ada6eb4c112c3f8767eea388203667aa3 -X "main.buildTime=\"Fri" Aug 14 19:52:14 UTC "2015\"" $WORK/_/tmp/bar.a
The shell quoting is wrong in the latter case: "main.buildTime=\"Fri" Aug 14 19:52:14 UTC "2015\""
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
cmd/ld: -X flag fails when used with non-deprecated = syntax
cmd/link: -X flag fails when used with non-deprecated = syntax
Aug 14, 2015
With go 1.5rc1 on darwin/amd64:
Test source:
-x
output:-x
output:The shell quoting is wrong in the latter case:
"main.buildTime=\"Fri" Aug 14 19:52:14 UTC "2015\""
The text was updated successfully, but these errors were encountered: