Reputation: 2063
I have a repo on Github which just holds some Go structs to be used as models throughout my services.
https://github.com/pocockn/models
I then want to import this into my services, I am using Go Modules in both repos. When I run 'go get' in my service I get the following error.
go: finding github.com/pocockn/models/api/football latestgo: finding github.com/pocockn/models/api latest go: finding github.com/pocockn/models latest go: github.com/pocockn/[email protected]: parsing go.mod: unexpected module path "models"
My go.mod file in the models repo looks like this
module models
go 1.12
require github.com/jinzhu/gorm v1.9.8
Upvotes: 3
Views: 2840
Reputation: 1698
Your module name in your go.mod
should be github.com/pocockn/models
, matching the repo path. It could also be a custom domain/path, assuming that domain either has the code hosted or the correct headers to redirect to your repo (using something like https://github.com/GoogleCloudPlatform/govanityurls).
(Looks like you may have already done this. Answering here if others find this question.)
Upvotes: 5