Skip to content

Commit bc0218a

Browse files
committed
internal/frontend: enable requests to std@master
Requests to pkg.go.dev/std@master are now supported. For golang/go#44390 Change-Id: Ie64ea679bfe855aa690004bf6effd7be424aa5dc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/294832 Trust: Julie Qiu <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]>
1 parent 7fcbd8b commit bc0218a

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

internal/frontend/urlinfo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func checkExcluded(ctx context.Context, ds internal.DataSource, fullPath string)
182182
// isSupportedVersion reports whether the version is supported by the frontend.
183183
func isSupportedVersion(fullPath, requestedVersion string) bool {
184184
if _, ok := internal.DefaultBranches[requestedVersion]; ok {
185-
return !stdlib.Contains(fullPath)
185+
return !stdlib.Contains(fullPath) || requestedVersion == "master"
186186
}
187187
return requestedVersion == internal.LatestVersion || semver.IsValid(requestedVersion)
188188
}

internal/frontend/urlinfo_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func TestIsSupportedVersion(t *testing.T) {
218218
{"net/http", "v1.2.3", true}, // isSupportedVersion expects the goTag is already converted to semver
219219
{"net/http", "v1.2.3.bad", false},
220220
{"net/http", "latest", true},
221-
{"net/http", "master", false},
221+
{"net/http", "master", true},
222222
{"net/http", "main", false},
223223
}
224224
for _, test := range tests {

internal/frontend/versions.go

+3
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ func pseudoVersionRev(v string) string {
276276
// displayVersion returns the version string, formatted for display.
277277
func displayVersion(v string, modulePath string) string {
278278
if modulePath == stdlib.ModulePath {
279+
if strings.HasPrefix(v, "v0.0.0") {
280+
return strings.Split(v, "-")[2]
281+
}
279282
return goTagForVersion(v)
280283
}
281284
return formatVersion(v)

0 commit comments

Comments
 (0)