f.lapo.it

#golang Fediverse please help a Go-noob: is it possible to get the `git describe` string from a `go install github.com…@latest` type installation?
In order to use for `--version` output, that in various projects report no version when installed that way.

E.g.:

% go install github.com/walles/moar@latest
% moar --version
Should be set when building, please use build.sh to build
1
Tanguy ⧓ Herrmann mastodon (AP)

you can use `go version` for that

`go version -m /path/to/binary`

1
Niiice! Would you like to answer the similar question I asked on SuperUser some time ago?
Else, I'll answer it myself linking your answer here.
1
Tanguy ⧓ Herrmann mastodon (AP)

with pleasure.
Will do immediatly :)
Thanks for doing this.

EDIT: it's done :)

Questa voce è stata modificata (2 mesi fa)
1
Filippo Valsorda :go: mastodon (AP)

pkg.go.dev/runtime/debug#ReadB…

(That doesn’t work yet when installing from a local directory. See github.com/golang/go/issues/50…)

1
Nice! I'll try to create a PR for moar --version to use that.
1