I have a common-libs
repo which consists of some shared code. It is structured using go workspaces and the file structure looks like this:
.
├── go.work
├── go.work.sum
├── middleware
│ ├── <some code>
│ ├── go.mod
│ ├── go.sum
As you can see it has one go module under directory middleware
.
I updated that repo and created a new release in Github and tagged it v1.0.1
.
I have a second repo api
which imports the common-libs/middleware
module like:
import "github.com/MyOrg/common-libs/middleware
I wanted to update the dependency version so in api
I changed go.mod file to
require (
github.com/MyOrg/common-libs/middleware v1.0.1
)
Now when I run go get ./...
it fails with a following error:
go: github.com/MyOrg/common-libs/[email protected]: reading github.com/MyOrg/common-libs/middleware/go.mod at revision middleware/v1.0.1: unknown revision middleware/v1.0.1
I don’t understand why it tries to find a tag with a prefix middleware
. What’s the right way to version submodule from a go workspace? Should I create a release with prefix middleware/v1.0.1
for it to work?