Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: debug/buildinfo: add time of build (not vcs.time) #60626

Closed
martinrode opened this issue Jun 6, 2023 · 3 comments
Closed

proposal: debug/buildinfo: add time of build (not vcs.time) #60626

martinrode opened this issue Jun 6, 2023 · 3 comments

Comments

@martinrode
Copy link

It seems there is no build info carrying the actual time a binary was built. I know we have the filename but for our use case it is not sufficient, because it can be changed easily. We would like to be able to not run a binary older than 1 year (after build time).

@gopherbot gopherbot added this to the Proposal milestone Jun 6, 2023
@seankhliao
Copy link
Member

This goes counter to our approach of making builds reproducible. The same input should produce the same output.

Building a go program at a different time shouldn't produce any different code.
Recompiling a binary doesn't really make it any safer, you should instead be looking at the inputs to the build, eg dependency versions, and compiler versions, both of which are recorded.

@mvdan
Copy link
Member

mvdan commented Jun 6, 2023

Note that you can always inject extra variables as needed, for example: go build -ldflags=-X=main.buildTimestamp=$(date +%s)

@ianlancetaylor
Copy link
Member

As @seankhliao says, this is not something we want to do, at least not by default. And as @mvdan says, we have mechanisms for people who really want it to do it. I'm going to close this as infeasible. Please comment if you disagree.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
@golang golang locked and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants