Skip to content

Commit 326f75f

Browse files
committed
content/static/doc: document vcs qualifiers in module paths
For golang/go#33637 Fixes golang/go#41267 Change-Id: Ic7928c05ef200b574afc15acdbabdc6ab2d5e30d Reviewed-on: https://go-review.googlesource.com/c/website/+/276354 Trust: Jay Conrod <[email protected]> Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent c2ddfaf commit 326f75f

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

content/static/doc/mod.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,17 +2108,27 @@ information.
21082108
### Finding a repository for a module path {#vcs-find}
21092109

21102110
When the `go` command downloads a module in `direct` mode, it starts by locating
2111-
the repository that contains the module. The `go` command sends an
2112-
HTTP `GET` request to a URL derived from the module path with a
2113-
`?go-get=1` query string. For example, for the module `golang.org/x/mod`,
2114-
the `go` command may send the following requests:
2111+
the repository that contains the module.
2112+
2113+
If the module path has a VCS qualifier (one of `.bzr`, `.fossil`, `.git`, `.hg`,
2114+
`.svn`) at the end of a path component, the `go` command will use everything up
2115+
to that path qualifier as the repository URL. For example, for the module
2116+
`example.com/foo.git/bar`, the `go` command downloads the repository at
2117+
`example.com/foo.git` using git, expecting to find the module in the `bar`
2118+
subdirectory. The `go` command will guess the protocol to use based on the
2119+
protocols supported by the version control tool.
2120+
2121+
If the module path does not have a qualifier, the `go` command sends an HTTP
2122+
`GET` request to a URL derived from the module path with a `?go-get=1` query
2123+
string. For example, for the module `golang.org/x/mod`, the `go` command may
2124+
send the following requests:
21152125

21162126
```
21172127
https://golang.org/x/mod?go-get=1 (preferred)
21182128
http://golang.org/x/mod?go-get=1 (fallback, only with GOINSECURE)
21192129
```
21202130

2121-
The `go` command will follow redirects but otherwise ignores response status
2131+
The `go` command follows redirects but otherwise ignores response status
21222132
codes, so the server may respond with a 404 or any other error status. The
21232133
`GOINSECURE` environment variable may be set to allow fallback and redirects to
21242134
unencrypted HTTP for specific modules.
@@ -2143,11 +2153,12 @@ module from the given URL using the [`GOPROXY`
21432153
protocol](#goproxy-protocol). This allows developers to distribute modules
21442154
without exposing source repositories.
21452155

2146-
`repo-url` is the repository's URL. If the URL does not include a scheme, the
2147-
`go` command will try each protocol supported by the version control system.
2148-
For example, with Git, the `go` command will try `https://` then `git+ssh://`.
2149-
Insecure protocols may only be used if the module path is matched by the
2150-
`GOINSECURE` environment variable.
2156+
`repo-url` is the repository's URL. If the URL does not include a scheme (either
2157+
because the module path has a VCS qualifier or because the `<meta>` tag lacks a
2158+
scheme), the `go` command will try each protocol supported by the version
2159+
control system. For example, with Git, the `go` command will try `https://` then
2160+
`git+ssh://`. Insecure protocols (like `http://` and `git://`) may only be used
2161+
if the module path is matched by the `GOINSECURE` environment variable.
21512162

21522163
As an example, consider `golang.org/x/mod` again. The `go` command sends
21532164
a request to `https://golang.org/x/mod?go-get=1`. The server responds

0 commit comments

Comments
 (0)