github.com/azazeal/revive@v1.0.9/testdata/bool-literal-in-expr.go (about) 1 package fixtures 2 3 func foo(a, b, c, d int) bool { 4 if bar == true { // MATCH /omit Boolean literal in expression/ 5 6 } 7 for f() || false != yes { // MATCH /omit Boolean literal in expression/ 8 9 } 10 11 return b > c == false // MATCH /omit Boolean literal in expression/ 12 } 13 14 // from github.com/jmespath/go-jmespath/functions.go 15 func jpfToNumber(arguments []interface{}) (interface{}, error) { 16 arg := arguments[0] 17 // code skipped 18 if arg == true || // MATCH /omit Boolean literal in expression/ 19 arg == false { // MATCH /omit Boolean literal in expression/ 20 return nil, nil 21 } 22 return nil, errors.New("unknown type") 23 } 24 25 // from gopkg.in/yaml.v2/resolve.go 26 func resolve(tag string, in string) (rtag string, out interface{}) { 27 if err == nil { 28 if true || intv == int64(int(intv)) { // MATCH /Boolean expression seems to always evaluate to true/ 29 return yaml_INT_TAG, int(intv) 30 } else { 31 return yaml_INT_TAG, intv 32 } 33 } 34 } 35 36 // from github.com/miekg/dns/msg_helpers.go 37 func packDataDomainNames(names []string, msg []byte, off int, compression map[string]int, compress bool) (int, error) { 38 var err error 39 for j := 0; j < len(names); j++ { 40 off, err = PackDomainName(names[j], msg, off, compression, false && compress) // MATCH /Boolean expression seems to always evaluate to false/ 41 if err != nil { 42 return len(msg), err 43 } 44 } 45 return off, nil 46 } 47 48 func isTrue(arg bool) bool { 49 return arg 50 } 51 52 func main() { 53 isTrue(true) 54 }