goversion
goversion copied to clipboard
goversion v1.2.0 fails to extract moduleinfo on 1.16.13 binary built via `go install`
rsc.io/[email protected] fails to extract the module info in this scenario:
$ KURED_VERSION=1.9.1
$ GOBIN=$PWD
$ go install -ldflags "-X main.version=${KURED_VERSION}" \
"github.com/weaveworks/kured/cmd/kured@${KURED_VERSION}"
$ goversion -m kured
kured go1.16.13
$
Obviously the built-in go version cmd in 1.16.13 can successfully extract the module info:
$ go version -m kured | head -5
kured: go1.16.13
path github.com/weaveworks/kured/cmd/kured
mod github.com/weaveworks/kured v0.0.0-20220106181305-2b36eab0f829 h1:gkiQx0LbROxAqRgcqLqO8dnKWWmbuHpOwwbOl9Numcc=
dep github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd h1:sjQovDkwrZp8u+gxLtPgKGjk5hCxuy2hrRejBTA9xFU=
dep github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
And similarly if I use Filo Sottile's version that rewrites atop the internal/version pkg (https://github.com/rsc/goversion/pull/17) then that can also read it:
$ goversion -m kured | head -5
kured go1.16.13
path github.com/weaveworks/kured/cmd/kured
mod github.com/weaveworks/kured v0.0.0-20220106181305-2b36eab0f829
dep github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd
dep github.com/PuerkitoBio/purell v1.1.1