Hello, I'm trying to use the -X ldflag to set a string at compile time. I can do this successfully if the string is in the main package but it does not work if the string is in a subpackage.
For illustration purposes, I have prepared a simple test project https://github.com/JetSetIlly/ldflags_X_test The build.sh file contains the build string. It contains one useful line, which I'll repeat it here: go build -ldflags "-X 'main.A=foo' -X 'sub.B=bar'" When built, the main function will print out the A string correctly but the B string is unset. What am I doing wrong? Regards Stephen -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/90c1b0aa-1bec-48dd-84d8-da5c558d730cn%40googlegroups.com.