Repository navigation
Conversation
sql.Scanner's Scan must use a pointer receiver, the same as the Unmarshal methods. Value types that implement it, such as database/sql.NullString and github.com/google/uuid.UUID, were reported as mixed receivers. The exclusions tests now disable the built-in list, because the built-in Scan exclusion alone would make them pass.
ldez
force-pushed
the
fix/exclude-scan
branch
from
November 5, 2026 14:24
6b64bf9 to
e8d48c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #52. The diff shows only the
Scanchange.Why
sql.Scannerrequires a pointer receiver, the same as theUnmarshalmethods that are already excluded:Value types that implement it are reported today. This includes the standard library's own types:
On
database/sql,github.com/google/uuidandgithub.com/shopspring/decimal, reports drop from 14 to 4. The 8database/sql.Null*types,uuid.UUIDanduuid.NullUUIDare no longer reported.What
*.Scanto the built-in exclusions.SQLtype to thebuiltinmethodsanddisablebuiltintestdata.DisableBuiltin: truein theexclusionsandexclusionswildcardtests. Their testdata is aScan/Valuepair, so the built-inScanexclusion alone would make them pass without the user exclusion.Trade-off
Scanis a more generic name than theUnmarshal*names, and exclusions match by name only. A type whose only pointer-receiver method is an unrelatedScan, such asScan() bool, is no longer reported.In the Go 1.27.3 standard library plus 49 popular modules, 32 types have
Scanas their only pointer-receiver method. All 32 use thesql.Scannersignature.Test
go test -race .passes, andgolangci-lint runreports 0 issues.analyzer.gochange reverted,builtinmethodsfails with an unexpected diagnostic onSQL.