internal/proxydatasource: support stdlib requests

The proxydatasource now supports requests for stdlib packages.

Change-Id: I96e8066c498a2ad9cf518c02f416e9255d5c3954
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238978
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/proxydatasource/datasource.go b/internal/proxydatasource/datasource.go
index de8d3f2..da455a6 100644
--- a/internal/proxydatasource/datasource.go
+++ b/internal/proxydatasource/datasource.go
@@ -23,6 +23,7 @@
 	"golang.org/x/pkgsite/internal/licenses"
 	"golang.org/x/pkgsite/internal/proxy"
 	"golang.org/x/pkgsite/internal/source"
+	"golang.org/x/pkgsite/internal/stdlib"
 	"golang.org/x/pkgsite/internal/version"
 )
 
@@ -240,8 +241,18 @@
 	if e, ok := ds.versionCache[key]; ok {
 		return e.module, e.err
 	}
-
-	res := fetch.FetchModule(ctx, modulePath, version, ds.proxyClient, ds.sourceClient)
+	v := version
+	if modulePath == stdlib.ModulePath {
+		if version == internal.LatestVersion {
+			// fetch.FetchModule does not support the latest endpoint for the
+			// standard library, but it is useful to look at these packages when
+			// developing with the proxydatasource. A hardcoded value is used here,
+			// so that the request won't fail.
+			v = "go1.14.4"
+		}
+		v = stdlib.VersionForTag(v)
+	}
+	res := fetch.FetchModule(ctx, modulePath, v, ds.proxyClient, ds.sourceClient)
 	m := res.Module
 	ds.versionCache[key] = &versionEntry{module: m, err: err}
 	if res.Error != nil {