internal/postgres: fix %q verb uses with wrong type
Caught early by the improved vet check gated behind the 1.26 language
version combined with a tiplang builder that tests with 1.26 language
version.
Change-Id: I25d2375d694af39ad1b2d8f97f3920990f852a15
Cq-Include-Trybots: luci.golang.try:x_pkgsite-gotip-linux-amd64-tiplang
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/725300
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
diff --git a/internal/postgres/insert_symbol_history.go b/internal/postgres/insert_symbol_history.go
index 9f0005f..5472080 100644
--- a/internal/postgres/insert_symbol_history.go
+++ b/internal/postgres/insert_symbol_history.go
@@ -133,22 +133,22 @@
defer derrors.WrapStack(&err, "appendSymbolHistoryRow(%q, %q, %q, %q)", sm.Name, packagePath, modulePath, ver)
symbolID := symToID[sm.Name]
if symbolID == 0 {
- return nil, fmt.Errorf("symbolID cannot be 0: %q", sm.Name)
+ return nil, fmt.Errorf("symbolID is 0 (for sm.Name = %q), but cannot be 0", sm.Name)
}
if sm.ParentName == "" {
sm.ParentName = sm.Name
}
parentID := symToID[sm.ParentName]
if parentID == 0 {
- return nil, fmt.Errorf("parentSymbolID cannot be 0: %q", sm.ParentName)
+ return nil, fmt.Errorf("parentID is 0 (for sm.ParentName = %q), but cannot be 0", sm.ParentName)
}
packagePathID := pathToID[packagePath]
if packagePathID == 0 {
- return nil, fmt.Errorf("packagePathID cannot be 0: %q", packagePathID)
+ return nil, fmt.Errorf("packagePathID is 0 (for packagePath = %q), but cannot be 0", packagePath)
}
modulePathID := pathToID[modulePath]
if modulePathID == 0 {
- return nil, fmt.Errorf("modulePathID cannot be 0: %q", modulePathID)
+ return nil, fmt.Errorf("modulePathID is 0 (for modulePath = %q), but cannot be 0", modulePath)
}
pkgsymID := pathToPkgsymID[packagePath][packageSymbol{synopsis: sm.Synopsis, name: sm.Name, parentName: sm.ParentName}]
return append(values,
diff --git a/internal/postgres/search/symbolsearch_test.go b/internal/postgres/search/symbolsearch_test.go
index df9e323..c863a73 100644
--- a/internal/postgres/search/symbolsearch_test.go
+++ b/internal/postgres/search/symbolsearch_test.go
@@ -44,7 +44,7 @@
t.Run(test.name, func(t *testing.T) {
got := ParseInputType(test.q)
if got != test.want {
- t.Errorf("ParseInputType(%q) = %q; want = %q", test.q, got, test.want)
+ t.Errorf("ParseInputType(%q) = %#v; want = %#v", test.q, got, test.want)
}
})
}
diff --git a/internal/postgres/symbol.go b/internal/postgres/symbol.go
index 1fbef0d..80d9a3a 100644
--- a/internal/postgres/symbol.go
+++ b/internal/postgres/symbol.go
@@ -396,7 +396,7 @@
pathToID map[string]int,
pathToDocIDToDoc map[string]map[int]*internal.Documentation,
latestPathToPkgsymToID map[string]map[packageSymbol]int) (err error) {
- defer derrors.WrapStack(&err, "deleteOldSymbolSearchDocuments(ctx, db, %q, pathToID, pathToDocIDToDoc)", modulePathID)
+ defer derrors.WrapStack(&err, "deleteOldSymbolSearchDocuments(ctx, db, %d, pathToID, pathToDocIDToDoc)", modulePathID)
// Get all package_symbol_ids for the latest module (the current one we are
// trying to insert).