I've now realized that Go saves absolute paths to source code in binaries for the purpose of printing stack-traces and the likes. I don't want to completely remove this information, however, this also means that every developer building the same program will produce an executable with a different checksum. Before I try to reimplement the build using chroot or something like that: isn't there any way to tell Go not to use absolute paths for this purpose?
一致的构建/从二进制文件中删除个人信息
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
doutuoshou8915 2016-09-27 16:27关注I know it doesn't directly address what you asked, but @JimB's suggestion does indicate a class of solutions to the problem you seem to be having.
One of the easier ones (I think) would be to have your developers install Docker and create an alias so that the
gocommand runs:docker run --rm --tty --volume $GOPATH:/go golang:1.7.1(-$YOUR_PLATFORM) goThen, every build (and test and run) thinks it's using a GOPATH of
/goand your developers' checksums won't disagree based on that.See here for more info.
解决 无用评论 打赏 举报