go/analysis/passes/modernize/testdata/src/minmax/nonstrict/nonstrict.go
raw| 1 | package nonstrict |
| 2 | |
| 3 | // min with <= operator - should be detected and removed |
| 4 | func min(a, b int) int { // want "user-defined min function is equivalent to built-in min and can be removed" |
| 5 | if a <= b { |
| 6 | return a |
| 7 | } else { |
| 8 | return b |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | // max with >= operator - should be detected and removed |
| 13 | func max(a, b int) int { // want "user-defined max function is equivalent to built-in max and can be removed" |
| 14 | if a >= b { |
| 15 | return a |
| 16 | } |
| 17 | return b |
| 18 | } |