edwinakatosh / go-bamboo-plugin

Plugin for Atlassian Bamboo that adds support for Go language projects
Apache License 2.0
19 stars 4 forks source link

Can't pass several build flags #14

Open alanraison opened 7 years ago

alanraison commented 7 years ago

When using the build task (and possibly others) and supplying -ldflags (and presumably also -asmflags, -gccgoflags, -gcflags, -tags and -toolexec, all of which accept a quoted list of values), the plugin is unable to parse the command line, presumably because the command is being space-delimited.

The command being run is:

go install -ldflags '-X main.version=112 -X main.buildID=ABC-112' ./cmd/exename

but the error indicates that the string inside the quotation marks has been incorrectly split:

invalid value "'-X" for flag -ldflags: unterminated ' string

Using " instead had the same effect, and attempting to escape the spaces with \ also did not work.

yamikuronue commented 7 years ago

@handcraftedbits If my issue is a duplicate... any idea what's causing this and plans to fix it?

handcraftedbits commented 7 years ago

It's because the current commandline parser just does a simple string split on spaces. Really it needs to know about all the flags that go build/install/test/etc. handle and split appropriately. That's a decent amount of work and I just haven't had the time to dive back into this project lately.

yamikuronue commented 7 years ago

Could you just pass the whole kit and kaboodle to the go command line and call it a day? The command line tool already knows how to parse its own arguments, in theory.

diegomarcov commented 6 years ago

This is still an issue. I need to:

go build --ldflags '-extldflags "-static"'

But it doesn't seem to be possible to pass extldflags. I agree with @yamikuronue , wouldn't it be easier to just pass the whole string?