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

go install regal does not provide any version information #1275

Open
sbp-bvanb opened this issue Nov 25, 2024 · 8 comments
Open

go install regal does not provide any version information #1275

sbp-bvanb opened this issue Nov 25, 2024 · 8 comments

Comments

@sbp-bvanb
Copy link

sbp-bvanb commented Nov 25, 2024

install regal
go install github.com/styrainc/[email protected]

issue regal version

Version:    unknown
Go Version: go1.23.3
Platform:   darwin/arm64
Commit:     unknown
Timestamp:  unknown
Hostname:   unknown

while

Version:    0.29.2
Go Version: go1.22.5
Platform:   darwin/amd64
Commit:     20a5cfaf7a721cc4d54b82f2f4ffc6c09b0b07cb
Timestamp:  2024-11-15T09:12:15Z
Hostname:   github.actions.local

is expected

@srenatus
Copy link
Member

I think this is to be expected since the build you grab from github was done via goreleaser, injects certain ldflags, etc. I believe most Go CLI tools fail to show proper versioning information when installed via go install.

That said, if you or someone else wants to tackle the problem, using runtime/debug's ReadBuildInfo() might be a way to figure out some of the fields even when installed via go install.

@sbp-bvanb
Copy link
Author

sbp-bvanb commented Nov 25, 2024

I still think that go install should be supported including versioning when this option is chosen to install regal. I can come up with more than five other golang tools that support versioning when they have been installed using go install.

@anderseknert
Copy link
Member

anderseknert commented Nov 25, 2024

Like you allude to, go install isn't "supported" in the sense that we list that as a recommended way to install Regal, but it's not like we'd stop anyone from improving that experience should they want that 🙂

Considering the huge number of golang tools around, "more than five" isn't exactly a large number. But if you drop some links to projects that does this, perhaps that would be helpful for whoever wants to work on this.

@anderseknert
Copy link
Member

https://github.com/open-policy-agent/opa

lol, touché! 🤣

Thanks 👍 that's helpful

@sbp-bvanb
Copy link
Author

Please let me know if I should create a PR. I am looking forward to this as I prefer go install over curl to install a go package.

@anderseknert
Copy link
Member

By all means, please do! 👍

@sbp-bvanb
Copy link
Author

PR has been created. Please review.

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

3 participants