| 1 |
package userdefined |
| 2 |
|
| 3 |
// User-defined function with different name - should NOT be removed |
| 4 |
func minimum(a, b int) int { |
| 5 |
if a < b { |
| 6 |
return a |
| 7 |
} else { |
| 8 |
return b |
| 9 |
} |
| 10 |
} |
| 11 |
|
| 12 |
// Method on a type - should NOT be removed |
| 13 |
type MyType struct{} |
| 14 |
|
| 15 |
func (m MyType) min(a, b int) int { |
| 16 |
if a < b { |
| 17 |
return a |
| 18 |
} else { |
| 19 |
return b |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
// min returns the smaller of two values. |
| 24 |
func min(a, b int) int { // want "user-defined min function is equivalent to built-in min and can be removed" |
| 25 |
if a < b { |
| 26 |
return a |
| 27 |
} else { |
| 28 |
return b |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
// max returns the larger of two values. |
| 33 |
func max(a, b int) int { // want "user-defined max function is equivalent to built-in max and can be removed" |
| 34 |
if a > b { |
| 35 |
return a |
| 36 |
} |
| 37 |
return b |
| 38 |
} |