3

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
1
  • 1
    Your module is github.com/pocockn/models but you initialized it only as models Commented May 11, 2019 at 17:11

1 Answer 1

5

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.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.