Closed
Description
(Splitting out of #70815 (comment) on behalf of @spencerschrock.)
Currently at HEAD (44b61a1d174cc06329b20f5de60c2b0c800741a4):
main.go:7:5: if/else statement can be modernized using max
package main
import "fmt"
func main() {
var x, y int
if x <= 0 { // a value of -1 or 0 will use a default value (30)
y = 30
} else {
y = x
}
fmt.Print(y)
}
Applying the suggested fix doesn't yield an equivalent result:
package main
import "fmt"
func main() {
var x, y int
y = max(x, 0)
fmt.Print(y)
}