If a Go repository has a go.mod
file in its root but also in a sub folder, how are versions of the submodule released?
By way of example, My team have been working with vault on our internal cli tool. We have ended up using:
github.com/hashicorp/vault/api
<-- has a go.mod
and
github.com/hashicorp/vault/commands
<-- doesn't have a go.mod so inherits from github.com/hashicorp/vault
I am trying to update vault/api to the latest version 1.3.3:
github.com/hashicorp/vault v1.3.3
github.com/hashicorp/vault/api v1.3.3
The problem is I get:
go: github.com/hashicorp/vault/[email protected]: reading github.com/hashicorp/vault/api/api/go.mod at revision api/v1.3.3: unknown revision api/v1.3.3
Which I think is caused by this root module and a conflict.
go.mod
references modules (i.e.github.com/hashicorp/vault
), but a module can contain many packages (i.e.github.com/hashicorp/vault/api
,github.com/hashicorp/vault/commands
, etc).vault/api
is a submodule though, not just a package invault
. Vault has a rather complicated module structure with several submodules that are versioned separately