8000 stylecheck/st1023: document the syscall/unsafe import exemption by akashchamp · Pull Request #1750 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

stylecheck/st1023: document the syscall/unsafe import exemption - #1750

Open
akashchamp wants to merge 1 commit into
dominikh:masterfrom
akashchamp:st1023-document-syscall-unsafe-exemption
Open

akashchamp wants to merge 1 commit into
dominikh:masterfrom
akashchamp:st1023-document-syscall-unsafe-exemption

Conversation

@akashchamp
Copy link
Copy Markdown

Fixes #1706.

ST1023 skips packages that import syscall or unsafe, since those
packages sometimes rely on an explicit type in a variable declaration
to pin down the exact type of a value. That's intentional
(internal/sharedcheck.RedundantTypeInDeclarationChecker), but wasn't
mentioned in the check's own public documentation, which was the
source of the confusion in #1706.

This adds a Text field to ST1023's RawDocumentation describing the
exemption, so it shows up in staticcheck -explain ST1023 and on
staticcheck.dev.

@akashchamp
akashchamp force-pushed the st1023-document-syscall-unsafe-exemption branch from 57d79d1 to 0771e82 Compare October 7, 2026 15:02
ST1023 intentionally does not flag redundant variable types in
packages that import syscall or unsafe, since these packages
sometimes rely on explicit types to pin down the exact type of a
value. That behavior was previously undocumented in the checks
public-facing docs, leading to confusion (dominikh#1706).
@akashchamp
akashchamp force-pushed the st1023-document-syscall-unsafe-exemption branch from 0771e82 to 972f8da Compare October 27, 2026 10:53
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.

ST1023: importing syscall package prevents the check from reporting errors

1 participant

0