I have a (private) github repo with a Go module. I've added the tag v0.1
and github shows that tag. I have set go env -w GOPRIVATE=github.com/dwschulze/key-value-mod
and my ~/.gitconfig has [url "git@github.com:"] insteadOf = https://github.com/
But go get
can't retrieve my module:
$ go get github.com/dwschulze/key-value-mod
go: github.com/dwschulze/key-value-mod upgrade => v0.0.0-20210907155619-9116b97467d6
go get: github.com/dwschulze/key-value-mod@v0.0.0-20210907155619-9116b97467d6: parsing go.mod:
module declares its path as: key-value-mod
but was required as: github.com/dwschulze/key-value-mod
$ go get github.com/dwschulze/key-value-mod@v0.1
go get github.com/dwschulze/key-value-mod@v0.1: no matching versions for query "v0.1"
What problem is go get
having?
Two things were causing this. I had to clear my module cache. The second is as Simon mentions above the module name has to be the repo URL where the module will be published.
I don't like the close coupling that go modules have with source code repositories, but that is reality.