-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: runtime/debug: embed vcs info into runtime/debug.BuildInfo when running go install #67745
Comments
in general, downloading a module strips any vcs info (e.g. a module zip from the proxy doesn't contain any git history). what you have instead is the modules' (pseudo)version, from which you may be able to infer an a commit in the vcs, but it's not a part of the module. I'm going to close this as infeasible. |
The info endpoint added VCS info fairly recently if I recall correctly. For example, see https://proxy.golang.org/golang.org/x/text/@v/v0.15.0.info. So it seems that this might be feasible? |
my understanding from #44742 (comment) was that the vcs info there was best-effort / non-canonical aid in debugging? |
IMHO, the same "unauthenticated" vcs info is helpful enough, for debugging. In this grpc-gateway's case, we need the vcs info because different version generates different stub code, so it would be nice if we could get the locate binary version and share it to my teammate. The other generators may meet the same issue that "different binary generates differently, but I dont know which version I am using and could not align with my teammate" Absolutely the author of the tools could manually update a version variable in the code every release, but it seems not elegant enough. As |
|
Thanks very much. I would have a look on this. |
Proposal Details
why
When we
go install
a pkg, we could not get the vcs info from runtime/debug.BuildSettingSo we could not get the binary version that installed from
go install
:And it is how the code does:
It would be nice if we could embed the vcs info and build time into the binary, so we could get the version and build time when installed from
go install
Please refer to this issue for more detail
How
I am still not sure if it could work but I would try later.
This is part of stack trace when we run
go install
:I wonder if we could update this opt
in installOutsideModulefrom
to
so that this piece of code could embed the vcs info into BuildInfo
And maybe it will be nice if we could have a build time in runtime/debug.BuildInfo as well.
If this proposal is accepted I would try to make a PR for it.
yours sincerely.
The text was updated successfully, but these errors were encountered: