len(execResult.GetStdErrString()) != 0
with execResult.GetStdErrString() != ""
716 return err
717 }
718
719 if len(execResult.GetStdErrString()) != 0 {720 return fmt.Errorf("%w:%s", nodes.ErrCommandExecError, execResult.GetStdErrString())
721 }
722
len(execResult.GetStdErrString()) != 0
with execResult.GetStdErrString() != ""
696 return err
697 }
698
699 if len(execResult.GetStdErrString()) != 0 {700 return fmt.Errorf("%w:%s", nodes.ErrCommandExecError, execResult.GetStdErrString())
701 }
702
len(execResult.GetStdErrString()) != 0
with execResult.GetStdErrString() != ""
674 return err
675 }
676
677 if len(execResult.GetStdErrString()) != 0 {678 return fmt.Errorf("%w:%s", nodes.ErrCommandExecError, execResult.GetStdErrString())
679 }
680
len(execResult.GetStdErrString()) != 0
with execResult.GetStdErrString() != ""
364 continue
365 }
366
367 if len(execResult.GetStdErrString()) != 0 {368 log.Debugf("readyForConfigCmd stderr: %s", string(execResult.GetStdErrString()))
369 time.Sleep(retryTimer)
370 continue
len(execResult.GetStdErrString()) != 0
with execResult.GetStdErrString() != ""
343 continue
344 }
345
346 if len(execResult.GetStdErrString()) != 0 {347 log.Debugf("error during checking SR Linux boot status: %s", execResult.GetStdErrString())
348 time.Sleep(retryTimer)
349 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.