chriswalz / bit

Bit is a modern Git CLI
Apache License 2.0
6.05k stars 106 forks source link

Homebrew installation shows 0.9.10, `bit --version` shows 0.8.0 #80

Closed macintacos closed 3 years ago

macintacos commented 3 years ago

Describe the bug I reinstalled the bit-git homebrew formula twice now, and am still getting the same results:

$ brew reinstall bit-git
==> Downloading https://homebrew.bintray.com/bottles/bit-git-0.9.10.catalina.bottle.tar.gz
Already downloaded: /Users/juliant/Library/Caches/Homebrew/downloads/f3b3548a66e7a547445566b4ebd93c283a5d35ef7bd6cfdeca1dd87ddcb3a2c5--bit-git-0.9.10.catalina.bottle.tar.gz
==> Reinstalling bit-git
==> Pouring bit-git-0.9.10.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/bit-git/0.9.10: 6 files, 13.3MB
$ bit --version
bit version v0.8.0
git version 2.29.2

I do see that there's a comment in main.go saying that "v0.8.0" should be overwritten at compile time - is this just an issue with the homebrew installation then? I just want to make sure I have the most recent version.

Expected behavior bit --version would output the correct, current version (0.9.10 at time of writing).

Desktop (please complete the following information):

chriswalz commented 3 years ago

@macintacos hmm I believe you're right.

in https://github.com/Homebrew/homebrew-core/blob/master/Formula/bit-git.rb

system "go", "build", *std_go_args

should be something like

system "go", "build", *std_go_args -ldflags "-X main.version=0.9.10"

Example in terminal

go build -ldflags "-X main.version=EXAMPLE.VERSION" main.go ./main --version bit version EXAMPLE.VERSION git version 2.24.3 (Apple Git-128)

chriswalz commented 3 years ago

@crunchtime-ali do you know? 🙏 I'm a ruby noob

crunchtime-ali commented 3 years ago

@crunchtime-ali do you know? 🙏 I'm a ruby noob

I will have a look at it tomorrow. I am also quite inexperienced with Ruby. I would prefer rewriting Homebrew in Golang or Rust but psst... don't tell anyone :)

macintacos commented 3 years ago

For the time being, just to clarify - I am running the latest, correct? It's just an issue with how the version number is calculated when pushing a new version to Homebrew or what have you?

chriswalz commented 3 years ago

@macintacos yep you're good. I'm confident based on this section: https://homebrew.bintray.com/bottles/bit-git-0.9.10.catalina.bottle.tar.gz

chriswalz commented 3 years ago

@crunchtime-ali did you around to looking at this. I'm pretty confident it's a one line fix similar to this go build -ldflags "-X main.version=EXAMPLE.VERSION" main.go

crunchtime-ali commented 3 years ago

@crunchtime-ali did you around to looking at this. I'm pretty confident it's a one line fix similar to this go build -ldflags "-X main.version=EXAMPLE.VERSION" main.go

Sorry, I didn't. I am a little swamped by working currently. Specifying the version manually will likely be the fix. I will get around to do it no later than Saturday and will also take a look at the other issues regarding the brew formula.

crunchtime-ali commented 3 years ago

@chriswalz @macintacos Sorry, it took a bit longer than expected. I just submitted a PR here https://github.com/Homebrew/homebrew-core/pull/64390

chriswalz commented 3 years ago

Great, thank you!