We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
go version
go version go1.7 linux/amd64
go env
GOARCH="amd64" GOBIN="/home/mediocregopher/src/go/bin" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/mediocregopher/src/go" GORACE="" GOROOT="/usr/lib/go" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build914586157=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1"
package main import "fmt" var foo string func main() { fmt.Printf("%q\n", foo) }
Then:
go build -ldflags '-X main.foo="bar baz"' main.go && ./main
"bar baz"
# command-line-arguments usage: link [options] main.o -B note add an ELF NT_GNU_BUILD_ID note when using ELF -C check Go calls to C code ... etc
The linker doesn't like spaces in the value. In 1.6 this could be worked around by not using the equal sign, but that form is no longer allowed in 1.7
EDIT: Should note, I've tried all combinations of single-quote/double-quote/no-quote I could think of, none seem to work
The text was updated successfully, but these errors were encountered:
go run -ldflags '-X "main.foo=bar baz"' main.go works for me.
Sorry, something went wrong.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
Then:
The linker doesn't like spaces in the value. In 1.6 this could be worked around by not using the equal sign, but that form is no longer allowed in 1.7
EDIT: Should note, I've tried all combinations of single-quote/double-quote/no-quote I could think of, none seem to work
The text was updated successfully, but these errors were encountered: