ldflags interpolation adds spurious quotes
Closed this issue · 4 comments
Hello, it looks like ldflags interpolation broke with Go 1.5. The symptom is that the interpolated string is surrounded by single quotes. For instance, I have a command line argument that simply prints the version number, and I get back this:
'1.0'
instead of:
1.0
Notice that I verified that the single quotes are actually being inserted in the final binary, so there's nothing happening in the application itself.
I run goxc -pv VERSION
. Adding some debugging prints to the goxc source code, I got this dump of the command line call:
"/usr/local/Cellar/go/1.5.2/libexec/bin/go" []string{"build", "-ldflags", "-w -s -X main.BUILD_DATE='2015-12-10T17:46:58+01:00' -X main.VERSION='29' ", "-o", "/Users/rasky/Sources/go/src/myproject/.output/29/darwin-amd64", "."}
The single quotes are being added in buildFlags()
. It doesn't seem this was recently changed, so I guess that it's the go binary that modified its behavior. I reproduce the same problem while running goxc on both darwin and linux.
The fix appears trivial (remove the quote escaping in buildFlags()) but I was wondering if there's more that misses the eye.
thanks for reporting. It looks like a straightforward fix, yes. I'm flat-stick right now, but I'll get onto it soon. [pull-requests very welcome, though]
Test & confirmed this fixes the problem on Go 1.6 for my setup:
https://github.com/jhillyerd/inbucket/blob/1.1.0-rc1/.goxc.json
OK thanks @jhillyerd . I merged that PR, #92