Let's take an example. The command below will do:
go get robpike.io/ivy
This will get me the content of the repository under $GOPATH/src. Great!
Now, how does it work?
First, robpike.io/ivy replies with a HTTP-redirect:
HTTP/1.1 302 Found
<a href="http://godoc.org/robpike.io/ivy">Found</a>
From reading at go help importpath
, I learn that:
If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a tag in the document's HTML
However, looking for a metatag inside the content of the redirected page using:
curl -D --raw https://godoc.org/robpike.io/ivy | grep go-import
returns nothing.
Reading further:
The repo-root is the root of the version control system containing a scheme and not containing a .vcs qualifier.
For example,
import "example.org/pkg/foo"
will result in the following requests:
https://example.org/pkg/foo?go-get=1 (preferred)
http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure)
Again:
curl -D --raw https://robpike.io/ivy?go-get=1
returns nothing.
So the question is: how can I do the same thing as Mr. Rob Pike and use my own site with the go get
command?