diff options
| author | Dmitri Shuralyov <dmitshur@golang.org> | 2025-11-28 12:46:30 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-11-28 14:04:31 -0800 |
| commit | d74adeade195e94064b1dc38fd14b93037ad7694 (patch) | |
| tree | a6d7d05ba7a50a9715fdd776c71b1795e5e6181a | |
| parent | 84333735ffe124f7bd904805fd488b93841de49f (diff) | |
| download | go-x-pkgsite-d74adeade195e94064b1dc38fd14b93037ad7694.tar.xz | |
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>
| -rw-r--r-- | internal/postgres/insert_symbol_history.go | 8 | ||||
| -rw-r--r-- | internal/postgres/search/symbolsearch_test.go | 2 | ||||
| -rw-r--r-- | 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). |
