-
Notifications
You must be signed in to change notification settings - Fork 551
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
Include git short hash or release indicator in contrib.Version()
#229
Comments
As @Aneurysm9 notes, what we're providing here are libraries, not standalone binaries (with the exception of the "examples"). We don't have control over build arguments of consuming applications to set link variables as used in the Postgres example and nearly all applications will consume the libraries as versioned modules, i.e. using the exact git commit corresponding to the tag that was released. However, we can't insert the git commit sha into the source code at the time we merge the prerelease branch to main, because the git commit in main doesn't yet exist - Catch 22. We could add an additional "version update" commit immediately after merging that updated the git commit in the source to be the same as the tagged version, but that seems messy. And it still doesn't help with trying to embed git commit information for subsequent commits of the source code. I looked over the What are your thoughts on implementing a solution such as this? Note: I also found this issue which describes future Go enhancements to automatically embed git sha/version information from the main repo into a binary (able to be disabled optionally). |
@evantorrie I think you make a good point in that this is not going to be built into a library. I'm going to relabel this for after GA, but I'm not entirely sure it is something we want to spend too much time on in light of the good points made. |
It would be ideal if the
contrib.Version()
function could include information about the git commit used if it is not a release tag. See comment on addition ofcontrib.Version()
. Unfortunately, theMakefile
-based approach used in the project referenced there looks like it would only work at the point of building an executable, which is outside the purview of this project. We may be able to usedebug.ReadBuildInfo
.The text was updated successfully, but these errors were encountered: