Commit 103fd0f
cmd/internal/pkgsite: improve godoc mode search in GOROOT
If a user starts go doc -http inside of GOROOT, we create three module
getters when we only need one: We create a StdlibZip module getter which
we're not going to use because we're using a local GOROOT, we create a
gopackages module getter for the module determined as corresponding to
the current directory, which is a stdlib module, and finally we create
the NewGoPackagesStdlibModuleGetter, which is the main module getter for
the standard library in that case.
The StdlibZip module getter is not used when we're using a local GOROOT,
so don't add it in that case. And if we detect that the module for a
specified directory is std or cmd for the specified local GOROOT, skip
adding it because it will be redundant with the module getter we create
using NewGoPackagesStdlibModuleGetter specifically for the standard
libarry.
Removing the redundant module getter will prevent redundant search
results returned by each of the gopackages module getters corresponding
to the standard library.
While we're here, if there's a VERSION file in GOROOT, set the version
on the module metadata we return for the standard library to the
stdlib.VersionForTag of that version, so we can report the version in
the search results.
Fixes golang/go#74459
Change-Id: If250f715b052f57f8668b02a57b4c96725be515a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/687918
Reviewed-by: Jonathan Amsterdam <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
kokoro-CI: kokoro <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
Auto-Submit: Michael Matloob <[email protected]>1 parent d4fd061 commit 103fd0f
2 files changed
+37
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
| |||
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
| 249 | + | |
243 | 250 | | |
244 | 251 | | |
245 | 252 | | |
| |||
250 | 257 | | |
251 | 258 | | |
252 | 259 | | |
| 260 | + | |
253 | 261 | | |
254 | 262 | | |
255 | 263 | | |
| |||
260 | 268 | | |
261 | 269 | | |
262 | 270 | | |
263 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
264 | 274 | | |
265 | 275 | | |
266 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
307 | | - | |
308 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
309 | 312 | | |
310 | 313 | | |
311 | 314 | | |
| |||
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
323 | 345 | | |
324 | 346 | | |
325 | 347 | | |
| |||
0 commit comments