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

cmd/errtrace: Uniquely identify the binary for toolexec version #93

Merged
merged 3 commits into from
Feb 18, 2024

Conversation

prashantv
Copy link
Contributor

The toolexec version should be bumped on any change to the code rewriting. Doing this manually is error-prone, so instead, use a string that uniquely identifies the errtrace binary. Note that every time this version changes, it means the build cache can't be used so it's important to use a stable value.

We default to the git SHA in the debug build info (vcs.revision) if the binary is build from a clean state (vcs.modified=false).

Otherwise, we use the MD5 of the binary being executed. This is more expensive than the SHA to compute, so we prefer the SHA.

@prashantv prashantv requested a review from abhinav February 18, 2024 07:03
The toolexec version should be bumped on any change to the code
rewriting. Doing this manually is error-prone, so instead, use
a string that uniquely identifies the errtrace binary. Note that
every time this version changes, it means the build cache can't be
used so it's important to use a stable value.

We default to the git SHA in the debug build info (vcs.revision)
if the binary is build from a clean state (vcs.modified=false).

Otherwise, we use the MD5 of the binary being executed. This is
more expensive than the SHA to compute, so we prefer the SHA.
@prashantv prashantv force-pushed the prashant/toolexec-version branch from 7566df7 to 05c6d7f Compare February 18, 2024 07:04
prashantv and others added 2 commits February 18, 2024 10:12
Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
@prashantv prashantv merged commit 0d9b854 into main Feb 18, 2024
12 checks passed
@prashantv prashantv deleted the prashant/toolexec-version branch February 18, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants