Like many folks, I often embed version information (git hash, build time, 
etc) into Go binaries with linker flags. Before Go 1.10, this worked:

go build -ldflags="-X 
github.com/user/top_level_project/vendor/github.com/user/version.Version=some_hash"
 github.com/user/top_level_project

After Go 1.10, I’m having trouble amending this approach in a way that only 
busts the build cache for the vendored version package.

go build -ldflags=all="-X 
github.com/user/top_level_project/vendor/github.com/user/version.Version=some_hash"
 github.com/user/top_level_project

works, but rebuilds much more than necessary. A variety of alternatives to 
=all= haven’t worked as I expected.

I’ve put together a small reproduction and a script showing the different 
approaches I’ve tried at github.com/akshayjshah/golink. Any suggestions 
would be very welcome!

Cheers,
Akshay
​

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to