-1

I want to set my go module path to example.com/myrepo instead of github.com/myusername/myrepo such that I am able to import in inside another repository.

for example, if my go.mod looks like this

module example.com/myrepo

go 1.13

how will I make go get example.com/myrepo work?

I am getting the following on go get example.com/myrepo

unrecognized import path "example.com/myrepo" (parse https://example.com/myrepo?go-get=1: no go-import meta tags ())

Given I am the owner of example.com how can I do this?

Amit Basuri
  • 563
  • 5
  • 12

1 Answers1

2

it is called vanity import paths.

In addition to the common hosting sites (GitHub, Bitbucket, etc) and custom VCS URLs (.git, .hg, etc) known to the go command, this mechanism can be used to point a custom URL to any of the services.

you must be looking for this https://sagikazarmark.hu/blog/vanity-import-paths-in-go/.

Niel_patel
  • 74
  • 8
  • 2
    “While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.” – Devon_C_Miller May 11 '20 at 19:38