#25 Consider using -trimpath
Closed 6 months ago by alexsaezm. Opened a year ago by rishi.

See this Toolbox discussion for context.

It might be good to include -trimpath in %gobuild and %gobuildflags. Apparently Arch Linux already uses it.


Metadata Update from @alexsaezm:
- Issue assigned to alexsaezm

7 months ago

Ping @alexsaezm Could you cut a new release once you fix this. I've merged the change regarding the tilde handling, it is needed by people packaging from SourceHut.

I created a PR with the change in case anyone has suggestions:

https://pagure.io/go-rpm-macros/pull-request/31

After considering it and talking with coworkers about why this flag was not included before, I think it doesn't make any sense, mainly because Koji builds in a sanitized build root, so nothing to leak. The same thing goes for reproducible builds.

Although it's a nice flag to have in a build, Go users are not affected by Go macros in their day to day.

But, perhaps I'm missing something here.

@harrymichal , @rishi what do you think?

I agree that -trimpath doesn't make any difference for official Fedora packages. Although, I wonder if it might help with ad-hoc local uses of rpmbuild.

I filed this issue in the context of this Toolbox pull request. You might have to show resolved for the entire discussion.

In short, I was trying to use Fedora's %gobuildflags as a reference to figure out the best set of build flags to use for upstream builds, and not seeing -trimpath in the list made me wonder if it might have negative side-effects. It was even more confusing because Fedora builds do pass -trimpath to the Go compiler, but that's different than passing it to the top-level go build invocation.

After reading the Go sources to get to the bottom of this, I no longer have a very strong opinion about this. Up to you. :)

In that case, I think we can drop this issue and my PR.

Metadata Update from @alexsaezm:
- Issue status updated to: Closed (was: Open)

6 months ago

Login to comment on this ticket.

Metadata