aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres
diff options
context:
space:
mode:
authorJamal Carvalho <jamal@golang.org>2020-12-14 08:47:41 -0500
committerJamal Carvalho <jamal@golang.org>2020-12-14 16:43:49 +0000
commit4e306af91274b1f7cd0d186347da1d7bbf941edb (patch)
tree55039dc31538c088c64fd3dbb26d39045593dfdc /internal/postgres
parent1556c6bf5bcae3690a58340ace2ef214784425f5 (diff)
downloadgo-x-pkgsite-4e306af91274b1f7cd0d186347da1d7bbf941edb.tar.xz
internal: add fields to unit meta struct
Adds HasGoMod and VersionType fields to the UnitMeta struct and ModFileURL and IsStableVersion to UnitMain to support the details section in the right sidebar. For golang/go#43129 Change-Id: Id605d27d6a421d7c5ff2afc39f4532b11e49ace6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277832 Reviewed-by: Julie Qiu <julie@golang.org> Trust: Julie Qiu <julie@golang.org> Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/postgres')
-rw-r--r--internal/postgres/path_test.go2
-rw-r--r--internal/postgres/unit.go2
2 files changed, 4 insertions, 0 deletions
diff --git a/internal/postgres/path_test.go b/internal/postgres/path_test.go
index 8dcb7b54..8d4e1217 100644
--- a/internal/postgres/path_test.go
+++ b/internal/postgres/path_test.go
@@ -188,6 +188,7 @@ func TestGetUnitMeta(t *testing.T) {
}
opts := []cmp.Option{
cmpopts.IgnoreFields(licenses.Metadata{}, "Coverage"),
+ cmpopts.IgnoreFields(internal.UnitMeta{}, "HasGoMod"),
cmp.AllowUnexported(source.Info{}, safehtml.HTML{}),
}
if diff := cmp.Diff(test.want, got, opts...); diff != "" {
@@ -380,6 +381,7 @@ func TestGetUnitMetaBypass(t *testing.T) {
}
opts := []cmp.Option{
cmpopts.IgnoreFields(licenses.Metadata{}, "Coverage"),
+ cmpopts.IgnoreFields(internal.UnitMeta{}, "HasGoMod"),
cmp.AllowUnexported(source.Info{}, safehtml.HTML{}),
}
if diff := cmp.Diff(test.want, got, opts...); diff != "" {
diff --git a/internal/postgres/unit.go b/internal/postgres/unit.go
index 8a2fec9b..18e64c9b 100644
--- a/internal/postgres/unit.go
+++ b/internal/postgres/unit.go
@@ -37,6 +37,7 @@ func (db *DB) GetUnitMeta(ctx context.Context, fullPath, requestedModulePath, re
"m.version",
"m.commit_time",
"m.source_info",
+ "m.has_go_mod",
"u.name",
"u.redistributable",
"u.license_types",
@@ -67,6 +68,7 @@ func (db *DB) GetUnitMeta(ctx context.Context, fullPath, requestedModulePath, re
&um.Version,
&um.CommitTime,
jsonbScanner{&um.SourceInfo},
+ &um.HasGoMod,
&um.Name,
&um.IsRedistributable,
pq.Array(&licenseTypes),