If you are going to publish a Go module does the module name have to 
include the repo name?  I couldn't find this documented anywhere but 
through trial and error I've discovered that it is required.

I named my module like this and published it to github:

*module key-value-mod*

In another module I declared it to be a dependency

*require github.com/dwschulze/key-value-mod v0.1.0*

When I ran *go get* I got this error:

*$ go get github.com/dwschulze/key-value-mod@v0.1.0*
*go: github.com/dwschulze/key-value-mod@v0.1.0: parsing go.mod:*
*        module declares its path as: key-value-mod*
*                but was required as: github.com/dwschulze/key-value-mod*

I changed the module's name to include the repo (and retagged that commit 
and pushed both)

*module github.com/dwschulze/key-value-mod*

and then it worked.

This is a private repo if that makes any difference.

I also discovered that when you have module problems like this you have to 
clear the mod cache or you end up getting the same error over and over 
again.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d7c5cc18-6c54-4379-92fe-f313a2c5bc01n%40googlegroups.com.

Reply via email to