-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
sample code
package main
import "fmt"
func main() {
s := ""
if len(s) == 0 { fmt.Println("len(s) == 0") }
if len(s) != 0 { fmt.Println("len(s) != 0") }
if len(s) > 0 { fmt.Println("len(s) > 0") }
}
gocritic check -enableAll main.go
gives only
./main.go:8:5: emptyStringTest: replace `len(s) != 0` with `s != ""`
./main.go:7:5: emptyStringTest: replace `len(s) == 0` with `s == ""`
and no complaints to replace len(s) > 0
with s != ""
cristaloleg
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request