aboutsummaryrefslogtreecommitdiff
path: root/cmd/pkgsite
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-09-04 21:14:41 -0400
committerJonathan Amsterdam <jba@google.com>2021-09-07 14:57:03 +0000
commitabd967ec8d6c66508150e98b979856ccea4f5193 (patch)
tree21ef1dc99c071010bc1791a8a1090c2ebd0372f7 /cmd/pkgsite
parentb06752c3e8c11efb242e3195390096c8897947c8 (diff)
downloadgo-x-pkgsite-abd967ec8d6c66508150e98b979856ccea4f5193.tar.xz
internal/fetch: use modcache dir for cache getter
A minor change to the ModuleGetter for the module cache: it now takes the cache directory itself, not the cache/download subdirectory. This will facilitate serving source. For golang/go#47982 Change-Id: I646471297e38de686586f2180608fc32cb59496d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347930 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'cmd/pkgsite')
-rw-r--r--cmd/pkgsite/main.go3
-rw-r--r--cmd/pkgsite/main_test.go4
2 files changed, 2 insertions, 5 deletions
diff --git a/cmd/pkgsite/main.go b/cmd/pkgsite/main.go
index 0700d9d9..3ec5bf8c 100644
--- a/cmd/pkgsite/main.go
+++ b/cmd/pkgsite/main.go
@@ -38,7 +38,6 @@ import (
"net/http"
"os"
"os/exec"
- "path/filepath"
"strings"
"time"
@@ -95,8 +94,6 @@ func main() {
die("empty value for GOMODCACHE")
}
}
- // We actually serve from the download subdirectory.
- downloadDir = filepath.Join(downloadDir, "cache", "download")
}
if *useCache || *useProxy {
diff --git a/cmd/pkgsite/main_test.go b/cmd/pkgsite/main_test.go
index 1c233f83..021a56e2 100644
--- a/cmd/pkgsite/main_test.go
+++ b/cmd/pkgsite/main_test.go
@@ -21,7 +21,7 @@ func Test(t *testing.T) {
repoPath := func(fn string) string { return filepath.Join("..", "..", fn) }
localModule := repoPath("internal/fetch/testdata/has_go_mod")
- cacheDir := repoPath("internal/fetch/testdata/modcache/cache/download")
+ cacheDir := repoPath("internal/fetch/testdata/modcache")
flag.Set("static", repoPath("static"))
testModules := proxytest.LoadTestModules(repoPath("internal/proxy/testdata"))
prox, teardown := proxytest.SetupTestClient(t, testModules)
@@ -41,7 +41,7 @@ func Test(t *testing.T) {
}{
{"local", "example.com/testmod", "There is no documentation for this package."},
{"modcache", "modcache.com@v1.0.0", "var V = 1"},
- {"modcache", "modcache.com", "var V = 1"},
+ {"modcache2", "modcache.com", "var V = 1"},
{"proxy", "example.com/single/pkg", "G is new in v1.1.0"},
} {
t.Run(test.name, func(t *testing.T) {