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 leaves the binary "unversioned" #1439

Closed
jbrains opened this issue Aug 16, 2021 · 8 comments
Closed

go install leaves the binary "unversioned" #1439

jbrains opened this issue Aug 16, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@jbrains
Copy link
Contributor

jbrains commented Aug 16, 2021

When I use go install to install lazygit, the resulting binary is "unversioned" according to lazygit --version. I presume that we'd like to have some build metadata available, especially to help with debugging/diagnosing defects.

  1. Clone the lazygit source.
  2. go install
  3. $HOME/.go/bin/lazygit --version

I get commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, but I expect at least the commit hash in this metadata.

Desktop (please complete the following information):

  • Pop!_OS 21.04
  • The last commit id if you built project from sources: 6c415d1
@jbrains jbrains added the bug Something isn't working label Aug 16, 2021
@mjarkk
Copy link
Contributor

mjarkk commented Aug 16, 2021

This might sound wired but this somewhat intended behavior.
These values are explicitly set in the CD, see /.goreleaser.yml#18 for how we do that.

But your point is still valid maybe we should have some go code generator that sets these values automatically.

@jbrains
Copy link
Contributor Author

jbrains commented Aug 18, 2021

Not weird, merely unexpected.

Should I use goreleaser, then, to build locally from source? (I just happened to learn yesterday what the sentence even means.)

@jesseduffield
Copy link
Owner

If there is a way to bake in the current tag or commit hash via go install I would definitely do that, but I don't actually know how haha

@jesseduffield
Copy link
Owner

This guide shows a way to do it, however it would require us providing a shell script that handles the different variables https://blog.alexellis.io/inject-build-time-vars-golang/

@jesseduffield
Copy link
Owner

I think Go might actually support this natively now: golang/go#37475

@jbrains
Copy link
Contributor Author

jbrains commented Jan 19, 2022

Excellent! Since I build from source, I find it helpful be able to confirm that I indeed built the expected version of lazygit and installed it to the right place without checking file timestamps.

@jesseduffield
Copy link
Owner

This is fixed in #2076

While I have the chance @jbrains I wanna say I've come across your blog posts on testing and they are phenomenal. Thanks for writing them!

@jbrains
Copy link
Contributor Author

jbrains commented Aug 1, 2022

I have the fix! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants