len(long) == 0
with long == ""
78
79 short := cmd.Short
80 long := cmd.Long
81 if len(long) == 0 { 82 long = short
83 }
84
len(line) == 0
with line == ""
561 for {
562 line, err := l.Readline()
563 if err == readline.ErrInterrupt {
564 if len(line) == 0 {565 break
566 } else {
567 continue
It is not recommended to use len
for empty string test.
A string can be tested for its emptiness either by treating it as a slice and calculating the length of the slice, or by treating it as a string and directly comparing the value. While both produce identical code when compiled, it makes more sense to treat a string as itself, than a slice, for the sake of comparison of values.
len(s) == 0
s == ""
The recommended practice is considered more idiomatic in Go.