mage icon indicating copy to clipboard operation
mage copied to clipboard

refactor(compile): add trimpath to compile to remove local paths

Open sheldonhull opened this issue 2 years ago • 3 comments

  • Include trimpath to ensure local filepaths from CI or developer don't get included in the produced artifact.
  • This was added in Go 1.13, so not sure if there is something special to handle adding this flag only if go version > 1.13.

Go documentation on this:

-trimpath remove all file system paths from the resulting executable. Instead of absolute file system paths, the recorded file names will begin either a module path@version (when using modules), or a plain import path (when using the standard library, or GOPATH).

sheldonhull avatar Feb 17 '23 20:02 sheldonhull

I feel like the aqua part should be called out in the title/desc somewhere....

EDIT: Ah, I see, that is from https://github.com/magefile/mage/pull/451 and just wasn't removed when making this PR. I'd suggest cleaning that up :D

jaredallard avatar Feb 18 '23 21:02 jaredallard

My mistake. I did a pr for that but did it on main branch in fork resulting in my new branch including that. I’ll have to separate this out.

sheldonhull avatar Feb 19 '23 18:02 sheldonhull

@jaredallard reverted back so pr changes are now just this. Not sure about compatibility for prior go versions to 1.13 like I mentioned but otherwise this will be good for privacy. Right now compiled binary includes full path. Cheers

sheldonhull avatar Feb 21 '23 18:02 sheldonhull