gitee.com/wgliang/goreporter@v0.0.0-20180902115603-df1b20f7c5d0/linters/simplecode/testdata/LintAssertNotNil.go (about)

     1  package pkg
     2  
     3  func fn(i interface{}) {
     4  	if _, ok := i.(string); ok && i != nil { // MATCH "when ok is true, i can't be nil"
     5  	}
     6  	if _, ok := i.(string); i != nil && ok { // MATCH "when ok is true, i can't be nil"
     7  	}
     8  	if _, ok := i.(string); i != nil || ok {
     9  	}
    10  	if _, ok := i.(string); i != nil && !ok {
    11  	}
    12  	if _, ok := i.(string); i == nil && ok {
    13  	}
    14  }