[solved] Why can't I go get github.com/hashicorp/vault/api@v1.11?

Hi there!

I have a project that depends on vault/api, and I’d like to use a feature in v1.11. Why does the @latest version query point to v1.8.0?

% go version
go version go1.19.1 darwin/amd64
% cd $(mktemp -d)
% go mod init tmp
% go get github.com/hashicorp/vault/api@latest
# ...snip...
% grep vault/api go.mod
	github.com/hashicorp/vault/api v1.8.0 // indirect
% go get github.com/hashicorp/vault/api@v1.11
go: module github.com/hashicorp/vault@v1.11 found (v1.11.4), but does not contain package github.com/hashicorp/vault/api

Is it because of this version constraint in the top-level go.mod? I see the PR that last changed that constraint here:

Does that mean the api module release cadence is different from the server and sdk releases? Is there documentation to that effect? Historically, I’ve been blissfully ignorant of go module resolution. In this case, though, I think I need to update my understanding.

Thank you!

Yes, exactly that.

When you have Go modules that are stored in subdirectories of a Git repository, such as Vault’s api and sdk, Go understands it needs to look for Git tags which include the subdirectory path in the tag name - such as the recently created api/v1.8.0 tag: GitHub - hashicorp/vault at api/v1.8.0, which points to a commit that is only 17 days old - quite different from the v1.8.0 Vault program release!

Thank you for that information! For posterity, I found the relevant section of the Go Modules Reference.