From d74adeade195e94064b1dc38fd14b93037ad7694 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Fri, 28 Nov 2025 12:46:30 -0500 Subject: 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 Reviewed-by: Dmitri Shuralyov Auto-Submit: Alan Donovan Reviewed-by: Alan Donovan LUCI-TryBot-Result: Go LUCI kokoro-CI: kokoro Commit-Queue: Alan Donovan --- internal/postgres/insert_symbol_history.go | 8 ++++---- internal/postgres/search/symbolsearch_test.go | 2 +- internal/postgres/symbol.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/postgres/insert_symbol_history.go b/internal/postgres/insert_symbol_history.go index 9f0005f4..54720800 100644 --- a/internal/postgres/insert_symbol_history.go +++ b/internal/postgres/insert_symbol_history.go @@ -133,22 +133,22 @@ func appendSymbolHistoryRow(sm *internal.SymbolMeta, values []any, 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 df9e323b..c863a731 100644 --- a/internal/postgres/search/symbolsearch_test.go +++ b/internal/postgres/search/symbolsearch_test.go @@ -44,7 +44,7 @@ func TestParseInputType(t *testing.T) { 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 1fbef0d4..80d9a3ab 100644 --- a/internal/postgres/symbol.go +++ b/internal/postgres/symbol.go @@ -396,7 +396,7 @@ func deleteOldSymbolSearchDocuments(ctx context.Context, db *database.DB, 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). -- cgit v1.3