@@ -2108,17 +2108,27 @@ information.
2108
2108
### Finding a repository for a module path {#vcs-find}
2109
2109
2110
2110
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:
2115
2125
2116
2126
```
2117
2127
https://golang.org/x/mod?go-get=1 (preferred)
2118
2128
http://golang.org/x/mod?go-get=1 (fallback, only with GOINSECURE)
2119
2129
```
2120
2130
2121
- The ` go ` command will follow redirects but otherwise ignores response status
2131
+ The ` go ` command follows redirects but otherwise ignores response status
2122
2132
codes, so the server may respond with a 404 or any other error status. The
2123
2133
` GOINSECURE ` environment variable may be set to allow fallback and redirects to
2124
2134
unencrypted HTTP for specific modules.
@@ -2143,11 +2153,12 @@ module from the given URL using the [`GOPROXY`
2143
2153
protocol] ( #goproxy-protocol ) . This allows developers to distribute modules
2144
2154
without exposing source repositories.
2145
2155
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.
2151
2162
2152
2163
As an example, consider ` golang.org/x/mod ` again. The ` go ` command sends
2153
2164
a request to ` https://golang.org/x/mod?go-get=1 ` . The server responds
0 commit comments