openSUSE / golang-packaging

golang packaging tool for openSUSE
GNU General Public License v3.0
6 stars 13 forks source link

Fix the handling of quoted extra args #16

Closed theMarix closed 6 years ago

theMarix commented 6 years ago

So far it was impossible to pass args containing whitespace, and thus requiring quoting, to the %gobuild macro as the quoting was used inconsistently. This caused the quoted arguments to be split up at the whitespace at some point, making it impossible to e.g. pass extra linker flags to set variable values via -X. This is e.g. required when building stuff using golang-github-prometheus-common, which expects the version information to be set via "-X %{import_path}/vendor/github.com/prometheus/common/version.Version=%{version}".

This is the first time I am attempting to contribute to the Go packaging tools and I am not primarily a Go developer myself. Thus, I hope I am following the right process. Otherwise, if you point me in the right direction I'll be happy to push my contribution down the proper path.

jordimassaguerpla commented 6 years ago

Hi. I just took a quick look and looks quite good, however I couldn't test it. Would you mind providing an example where you use this modifications and the output?

theMarix commented 6 years ago

Thanks for the quick response. I ran into the issue trying to improve my Prometheus node exporter package. As the fix is not in OBS I don't have the usage there yet, but only copied my modified file into my local build environment. Using the attached modified spec file this gives me the attached log from osc build. I hope this is the kind of example you were looking for. Otherwise let me know and I'll try to figure out something more minimalistic.

jordimassaguerpla commented 6 years ago

@theMarix Thanks. LGTM