Using a vanity import path allows repositories to migrate between providers seamlessly without modifications to consumer code.
go get
(since 1.4) has support for determining the actual location of vcs repositories given a canonical import path via inclusion of a html meta
tag in the response of the canonical location. The canonical import path must correspond with an actual http(s) endpoint, responding with a html document including a meta
tag containing the canonical import path, vcs repository type [git|bzr|hg], and the actual location.
For example, a repository github.com/example/myproject
may be served from example.org/myproject
, by including the following snippet in the http response for https://example.org/myproject?go-get=1
.
<!-- redirect `go get` to github -->