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/go: go install does not provide vcs.revision buildinfo #65904

Closed
AlexanderYastrebov opened this issue Feb 23, 2024 · 4 comments
Closed

cmd/go: go install does not provide vcs.revision buildinfo #65904

AlexanderYastrebov opened this issue Feb 23, 2024 · 4 comments

Comments

@AlexanderYastrebov
Copy link
Contributor

Go version

go version go1.22.0 linux/amd64

Output of go env in your module/workspace:

-

What did you do?

Added a snippet to read vcs.revision setting from debug.ReadBuildInfo()
zalando/skipper#2954
and installed the binary:

~$ rm $(which skipper)
~$ go install github.com/zalando/skipper/cmd/skipper@latest

What did you see happen?

version output contains proper version (info.Main.Version) but empty commit (vcs.revision)

~$ skipper -version
Skipper version v0.21.3 (commit: , runtime: go1.22.0)

What did you expect to see?

non-empty commit zalando/skipper@8c03dfb

~$ skipper -version
Skipper version v0.21.3 (commit: 8c03dfbd, runtime: go1.22.0)
@seankhliao
Copy link
Member

I believe this is working as intended?
when a module is obtained from the module proxy, there's no association with any git commit, only the version it matched, so there's no data to populate it from.

@AlexanderYastrebov
Copy link
Contributor Author

Do I get it right that Main.Version and vcs.revision are mutually exclusive - build info for go install provides Main.Version but not vcs.revision while go build does not provide Main.Version (it uses stub (devel), #50603 seems related) but provides vcs.revision:

$ go build -o bin/skipper ./cmd/skipper && ./bin/skipper -version
Skipper version (devel) (commit: 8c03dfbd, runtime: go1.22.0)

AlexanderYastrebov added a commit to zalando/skipper that referenced this issue Feb 23, 2024
Binary installed via `go install github.com/zalando/skipper/cmd/skipper@latest`
does not contain `vcs.revision`, see golang/go#65904

Followup on #2954

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
@seankhliao
Copy link
Member

go build:

go install pkg@version:

  • set Version to resolved version

@AlexanderYastrebov
Copy link
Contributor Author

@seankhliao Thank you for the prompt response and clarification.

AlexanderYastrebov added a commit to zalando/skipper that referenced this issue Feb 23, 2024
Binary installed via `go install github.com/zalando/skipper/cmd/skipper@latest`
does not contain `vcs.revision`, see golang/go#65904

Followup on #2954

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
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

No branches or pull requests

2 participants