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

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

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

EDIT: it's done :)

Questa voce è stata modificata (2 settimane fa)
1

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