lazygit show version not working in Ubuntu 18.04

Created on 8 Aug 2018  路  5Comments  路  Source: jesseduffield/lazygit

lazygit version is a253b0b897180923909016942fdc064cb7935849, running lg -v
the output just shows:
rev=, build date=%

go version go1.10.3 linux/amd64
install method: go get github.com/jesseduffield/lazygit

All 5 comments

Maybe @ponsfrilus could give some hints? https://github.com/jesseduffield/lazygit/commit/4d9d2b134f7578cc5ff394956f9ecf5ccaf03566 seems not adding rev info in building process.

The binaries in the release section are built with gox which sends the rev and builddate variables into the binary, effectively baking them in as constants. I'm not sure how we could do that for lazygit's that have just been obtained via go get, because the go install part happens locally

go get -x -u -ldflags "-X main.Rev=goget -X main.builddate=date -u +%Y%m%d.%H%M%S" github.com/jesseduffield/lazygit
will works, but the "usual" main.Rev flags will obviously not work as it use the git rev-parse command.

Pointers:

I made some digging and I didn't find a way to get the a version number up to date in any case.

As an exemple, Kubernetes save versions in a file:

// This is the fallback data used when version information from git is not
// provided via go ldflags. It provides an approximation of the Kubernetes
// version for ad-hoc builds (e.g. go build) that cannot get the version
// information from git.

See https://github.com/kubernetes/kubernetes/blob/master/pkg/version/base.go.

Versions are coming from this shell script.

So I guess a fall back to a file is the only way to get these in every cases.

I've got a 'VERSION' file in the root directory now which just stored the current version e.g. 'v0.1.45'. If the binary itself hasn't had the variable baked in and the user has obtained the binary via go, the version from the repo will be shown.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jangalinski picture jangalinski  路  4Comments

jclappiway picture jclappiway  路  7Comments

pshirshov picture pshirshov  路  3Comments

glvr182 picture glvr182  路  6Comments

rubensr-pc picture rubensr-pc  路  5Comments