8000 Avoid SA1006 fixes with missing errors import by dajiaohuang · Pull Request #1769 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

Avoid SA1006 fixes with missing errors import - #1769

Open
dajiaohuang wants to merge 2 commits into
dominikh:masterfrom
dajiaohuang:fix/sa1006-errors-import
Open

dajiaohuang wants to merge 2 commits into
dominikh:masterfrom
dajiaohuang:fix/sa1006-errors-import

Conversation

@dajiaohuang
@dajiaohuang dajiaohuang commented Oct 1, 2026 •
Copy link
Copy Markdown

SA1006 retains its diagnostic for dynamic fmt.Errorf calls and offers an errors.New replacement only when a usable errors package import is visible at that call. It preserves the actual alias in the diagnostic file and avoids borrowing an import from another file or using a locally shadowed alias.

Regression/golden fixtures cover a usable alias, another source file without the import, and local shadowing. This change does not add or remove imports.

Validation: go test ./staticcheck/sa1006 passed (two tests); gofmt and git diff --check passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0