Commit f7fd4ef
committed
cmd/stringer: omit negative bounds check from String() for unsigned integers
Commit 82041a1 ("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]>1 parent d2096d1 commit f7fd4ef
1 file changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
645 | 650 | | |
646 | 651 | | |
647 | 652 | | |
648 | 653 | | |
649 | 654 | | |
650 | 655 | | |
651 | 656 | | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
652 | 673 | | |
653 | 674 | | |
654 | 675 | | |
| |||
0 commit comments