should omit nil check; len() for github.com/go-graphite/carbonapi/pkg/parser.NamedArgs is defined as zero
115}
116
117func mapExpr(m NamedArgs) map[string]*expr {
118 if m == nil || len(m) == 0 {119 return nil
120 }
121 res := make(map[string]*expr)
Description
The length of a nil
slice evaluates to zero. Hence, there is no need to check
whether a slice is nil
before calculating its length.
Bad practice
if x != nil && len(x) != 0 {
x[0] = 1
}
Recommended
if len(x) != 0 {
x[0] = 1
}