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>
diff --git a/internal/postgres/unit.go b/internal/postgres/unit.go
index 828fdd6..baed7ca 100644
--- a/internal/postgres/unit.go
+++ b/internal/postgres/unit.go
@@ -196,7 +196,10 @@
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)