aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/insert_module.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2021-07-01 18:55:31 -0400
committerJulie Qiu <julie@golang.org>2021-07-13 16:26:28 +0000
commitc1fa4f41069c5a8861fc2d0c0207fa34b7b5dc2d (patch)
treec4bcb2dfa13fb2f351e85eb1e21dacf7e459bc44 /internal/postgres/insert_module.go
parent01e3e3198312fe6a30cf012b4d06bee6872f7ef8 (diff)
downloadgo-x-pkgsite-c1fa4f41069c5a8861fc2d0c0207fa34b7b5dc2d.tar.xz
internal/postgres: fix bug in isAlternativeModule
At the moment, isAlternativeModulePath does not filter on the modulePath argument, which means that it reports whether the latest version of a random module has status 491, and not the specified module. This bug is fixed and a test is added. Change-Id: I7a0feb960e1f1e6b7de2fb7a82ec0ea2fdcce738 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/332378 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/postgres/insert_module.go')
-rw-r--r--internal/postgres/insert_module.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/postgres/insert_module.go b/internal/postgres/insert_module.go
index 387ab748..d11511a3 100644
--- a/internal/postgres/insert_module.go
+++ b/internal/postgres/insert_module.go
@@ -205,7 +205,8 @@ func isAlternativeModulePath(ctx context.Context, db *database.DB, modulePath st
WHERE p.id = l.module_path_id
AND p.path = s.module_path
AND l.cooked_version = s.version
- `).Scan(&status); err {
+ AND s.module_path = $1
+ `, modulePath).Scan(&status); err {
case sql.ErrNoRows:
// Not enough information; assume false so we don't omit a valid module
// from search.