Skip to content

Help with querying for the binary's version at runtime #3780

Answered by caarlos0
dlvhdr asked this question in Q&A
Discussion options

You must be logged in to vote

Hey!

OK, a couple of things:

  1. these need to be public fields https://github.com/dlvhdr/gh-dash/blob/2b44bd659d8f289dd48f7ac7f523a3ddf4c464bf/cmd/root.go#L22-L25
  2. the -X main.version flags need to point to that cmd pkg, you can try it out locally with go build to figure out the right combination
  3. if you set gomod.enabled, yes, it'll require the tag to be pushed, because it'll use the code from the go mod proxy
  4. 3 is also why you get your second error: you pushed the tag, build it (which got it proxied to the go mod proxy), deleted it, changed something, retagged, pushed again, and tried to build again, and now the tag in the go mod proxy does not match the tag in git... tl;dr: do not recreate…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dlvhdr
Comment options

@caarlos0
Comment options

Answer selected by dlvhdr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants