8000 Fix SA4026 fixes for math imports by dajiaohuang · Pull Request #1768 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

Fix SA4026 fixes for math imports - #1768

Open
dajiaohuang wants to merge 2 commits into
dominikh:masterfrom
dajiaohuang:fix/sa4026-math-alias
Open

dajiaohuang wants to merge 2 commits into
dominikh:masterfrom
dajiaohuang:fix/sa4026-math-alias

Conversation

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

SA4026 offers a math.Copysign fix only when a usable math package import is visible at the diagnostic position, preserving that file's actual import alias. Imports from another file and locally shadowed aliases do not produce an unsafe fix; the diagnostic is retained.

The review follow-up also removes a nil report option that would panic when no usable math import exists. Regression/golden fixtures cover an aliased import, a second file without the import, and a locally shadowed alias.

Validation: go test ./staticcheck/sa4026 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