Get version for top level module

I’m exploring a way to determine the version (or pseudo-version) of an application module. For example, let’s say I clone kubernetes and from that local clone I’d like go to display the version as determined by go.

It seem that the only way I can do that is by using go get directly:

$ go get -d
go: downloading v0.15.0
go: extracting v0.15.0

See how go automatically determined version v0.15.0 from the commit 34338e7107c1868124f8aab2446f6b71c9b0640f.

The problem I’m facing is that I already have the repository cloned, so using go get seems wasteful. For very large repos, it is unacceptable in my use case.

Any ideas?

1 Like

Don’t quite getting you. Can you use git clone k9n repository then git tag --list or git log? Another way is to view their github repository for getting information?

go get is like a tool to clone repository, go build the binary (if any), go install into GOBIN (if any), all under a single command. You only use it to download binary. It’s not a one tool does everything though.

1 Like

It’s more complicated than that because of Pseudo Versions.

Go cmd has the functionality to determine the pseudo version for a repo, but it doesn’t seem to expose it in a way that doesn’t require re-fetching it.

1 Like

Cross-checked quite a number of resources, I don’t think there is any easy way to obtain the pseudo-versions tag apart from manual construction.

Perhaps you can raise a ticket for feature request to expose it. You might need a very good reason since go.mod handles pseudo-versions automatically.

Some resources:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.