aboutsummaryrefslogtreecommitdiff
path: root/internal/queue/queue.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-03-25 15:53:53 -0400
committerJonathan Amsterdam <jba@google.com>2021-03-25 19:59:34 +0000
commit233fac44be2d5665490e1d82cbb472ae99845a2e (patch)
treecd7923cd21ecaf217ee8215253fb318e800a81ba /internal/queue/queue.go
parent101343b2dd9dbde2dcbdf934e05d636cba8b7a26 (diff)
downloadgo-x-pkgsite-233fac44be2d5665490e1d82cbb472ae99845a2e.tar.xz
internal/queue: check for unknown module path
ScheduleFetch checks that it is not given "unknownModulePath". Change-Id: Ie2ae0bde75ad10103b9ea8fb526aa7f09c285733 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/304889 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/queue/queue.go')
-rw-r--r--internal/queue/queue.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/queue/queue.go b/internal/queue/queue.go
index c77f3b52..30d92742 100644
--- a/internal/queue/queue.go
+++ b/internal/queue/queue.go
@@ -18,6 +18,7 @@ import (
cloudtasks "cloud.google.com/go/cloudtasks/apiv2"
"github.com/golang/protobuf/ptypes"
+ "golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/config"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
@@ -124,6 +125,9 @@ func (q *GCP) ScheduleFetch(ctx context.Context, modulePath, version, suffix str
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
+ if modulePath == internal.UnknownModulePath {
+ return false, errors.New("given unknown module path")
+ }
req := q.newTaskRequest(modulePath, version, suffix, disableProxyFetch)
enqueued = true
if _, err := q.client.CreateTask(ctx, req); err != nil {