aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/unit.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2021-02-25 16:57:03 -0500
committerJulie Qiu <julie@golang.org>2021-02-25 23:54:48 +0000
commitd820a98ba608b7acc1bc85149edda0ece25793d5 (patch)
treefdb48a7eac230da08a0d23838279d20286dded7d /internal/postgres/unit.go
parent3e68221cfeacbfd0ed7e4f9863b85e72aa3e3c70 (diff)
downloadgo-x-pkgsite-d820a98ba608b7acc1bc85149edda0ece25793d5.tar.xz
internal/postgres: fix GetUnit tests
Change-Id: I8b15ff46d34fb234d222823bb60f24f08cf09ec8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296632 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/postgres/unit.go')
-rw-r--r--internal/postgres/unit.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/postgres/unit.go b/internal/postgres/unit.go
index 828fdd69..baed7ca7 100644
--- a/internal/postgres/unit.go
+++ b/internal/postgres/unit.go
@@ -196,7 +196,10 @@ func (db *DB) GetUnit(ctx context.Context, um *internal.UnitMeta, fields interna
if err != nil {
return nil, err
}
- u.Symbols = symbols
+ // Return nil if there are no symbols, instead of an empty map.
+ if len(u.Symbols) > 0 {
+ u.Symbols = symbols
+ }
}
if fields&internal.WithImports != 0 {
imports, err := db.getImports(ctx, unitID)