aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/unit.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-09-20 18:30:55 -0400
committerJulie Qiu <julie@golang.org>2020-09-21 20:13:15 +0000
commita222c19db44451f4140d2345490645b821608b58 (patch)
tree4ae5867e1394ade97d59e70794ef8b347a8e97fe /internal/postgres/unit.go
parentf1ac6e3ac657dbbc46935c3d2262d50b14b0fc90 (diff)
downloadgo-x-pkgsite-a222c19db44451f4140d2345490645b821608b58.tar.xz
internal/postgres: rename variable version
Various uses of the variable version is renamed to requestedVersion and resolvedVersion for clarity. Change-Id: I9dc4987d605631549497261b18f165fc9c157508 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/256178 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/postgres/unit.go')
-rw-r--r--internal/postgres/unit.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/postgres/unit.go b/internal/postgres/unit.go
index 41674f2f..2e0d2e48 100644
--- a/internal/postgres/unit.go
+++ b/internal/postgres/unit.go
@@ -74,8 +74,8 @@ func (db *DB) GetUnit(ctx context.Context, um *internal.UnitMeta, fields interna
return u, nil
}
-func (db *DB) getPathID(ctx context.Context, fullPath, modulePath, version string) (_ int, err error) {
- defer derrors.Wrap(&err, "getPathID(ctx, %q, %q, %q)", fullPath, modulePath, version)
+func (db *DB) getPathID(ctx context.Context, fullPath, modulePath, resolvedVersion string) (_ int, err error) {
+ defer derrors.Wrap(&err, "getPathID(ctx, %q, %q, %q)", fullPath, modulePath, resolvedVersion)
var pathID int
query := `
SELECT p.id
@@ -85,7 +85,7 @@ func (db *DB) getPathID(ctx context.Context, fullPath, modulePath, version strin
p.path = $1
AND m.module_path = $2
AND m.version = $3;`
- err = db.db.QueryRow(ctx, query, fullPath, modulePath, version).Scan(&pathID)
+ err = db.db.QueryRow(ctx, query, fullPath, modulePath, resolvedVersion).Scan(&pathID)
switch err {
case sql.ErrNoRows:
return 0, derrors.NotFound
@@ -129,8 +129,8 @@ func (db *DB) getDocumentation(ctx context.Context, pathID int) (_ *internal.Doc
}
// getReadme returns the README corresponding to the modulePath and version.
-func (db *DB) getReadme(ctx context.Context, modulePath, version string) (_ *internal.Readme, err error) {
- defer derrors.Wrap(&err, "getReadme(ctx, %q, %q)", modulePath, version)
+func (db *DB) getReadme(ctx context.Context, modulePath, resolvedVersion string) (_ *internal.Readme, err error) {
+ defer derrors.Wrap(&err, "getReadme(ctx, %q, %q)", modulePath, resolvedVersion)
// TODO(golang/go#38513): update to query on PathID and query the readmes
// table directly once we start displaying READMEs for directories instead
// of the top-level module.
@@ -145,7 +145,7 @@ func (db *DB) getReadme(ctx context.Context, modulePath, version string) (_ *int
WHERE
m.module_path=$1
AND m.version=$2
- AND m.module_path=p.path`, modulePath, version).Scan(&readme.Filepath, &readme.Contents)
+ AND m.module_path=p.path`, modulePath, resolvedVersion).Scan(&readme.Filepath, &readme.Contents)
switch err {
case sql.ErrNoRows:
return nil, derrors.NotFound