-
Notifications
You must be signed in to change notification settings - Fork 2.3k
cmd/stringer: omit negative bounds check from String for unsigned integers #599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This PR (HEAD: f7fd4ef) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/711300. Important tips:
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/711300. |
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be Please don’t reply on this GitHub thread. Visit golang.org/cl/711300. |
Message from Ian Lance Taylor: Patch Set 1: (5 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/711300. |
…egers CL 707396 ("cmd/stringer: fix bounds checking for integer types spanning full range") introduced a universal lower bounds check for all integers, including unsigned ints. Unfortunately, performing a <0 bounds check on a uint gets flagged by static analysis tools like staticcheck. This commit only emits the bounds check if the type in question is either signed or has a non-zero minimum value, in which case the bounds check is necessary for unsigned types as well. Signed-off-by: Timo Beckers <[email protected]>
This PR (HEAD: 35329ce) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/711300. Important tips:
|
Message from Timo Beckers: Patch Set 2: (7 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/711300. |
CL 707396 ("cmd/stringer: fix bounds checking for integer types spanning full
range") introduced a universal lower bounds check for all integers, including
unsigned ints. Unfortunately, performing a <0 bounds check on a uint gets
flagged by static analysis tools like staticcheck.
This commit only emits the bounds check if the type in question is either
signed or has a non-zero minimum value, in which case the bounds check is
necessary for unsigned types as well.