Repository navigation
stylecheck/st1023: document the syscall/unsafe import exemption - #1750
Open
akashchamp wants to merge 1 commit into
Open
akashchamp wants to merge 1 commit into
akashchamp wants to merge 1 commit into
Conversation
akashchamp
force-pushed
the
st1023-document-syscall-unsafe-exemption
branch
from
October 7, 2026 15:02
57d79d1 to
0771e82
Compare
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
force-pushed
the
st1023-document-syscall-unsafe-exemption
branch
from
October 27, 2026 10:53
0771e82 to
972f8da
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.
Fixes #1706.
ST1023 skips packages that import
syscallorunsafe, since thosepackages 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'tmentioned in the check's own public documentation, which was the
source of the confusion in #1706.
This adds a
Textfield to ST1023'sRawDocumentationdescribing theexemption, so it shows up in
staticcheck -explain ST1023and onstaticcheck.dev.