Support for Go remote import
Adding support for the go-import
meta tag and the ?go-get=1
parameter might be useful for Go repos. See Remote Import Paths:
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
.The meta tag has the form:
<meta name="go-import" content="import-prefix vcs repo-root">
The import-prefix is the import path corresponding to the repository root. It must be a prefix or an exact match of the package being fetched with "go get". If it's not an exact match, another http request is made at the prefix to verify the tags match.
The meta tag should appear as early in the file as possible. In particular, it should appear before any raw JavaScript or CSS, to avoid confusing the go command's restricted parser.
The vcs is one of "git", "hg", "svn", etc,
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)If that page contains the meta tag
<meta name="go-import" content="example.org git https://code.org/r/p/exproj">
the go tool will verify that https://example.org/?go-get=1 contains the same meta tag and then git clone https://code.org/r/p/exproj into GOPATH/src/example.org.
New downloaded packages are written to the first directory listed in the GOPATH environment variable (For more details see: 'go help gopath').
The go command attempts to download the version of the package appropriate for the Go release being used. Run 'go help get' for more.