#How to embed module version in binary?

2 messages · Page 1 of 1 (latest)

tough scroll
#

I have tried using go build -buildvcs=true but debug.ReadBuildInfo().Main.Version is still empty.

On top of that, this issue can be reproduced in a git repo with the following test:

func TestReadBuildInfo(t *testing.T) {
    bi, ok := debug.ReadBuildInfo()
    require.True(t, ok)
    require.NotEmpty(t, bi.Main.Version)
}

go test -buildvcs=true ./...

Is there something I am missing here? How do I get this working?

gray cypress
#

is this executable you're building part of a module?