len(r.Env) == 0
with r.Env == ""
596 Manifest: kr.Spec.Manifest,
597 }
598
599 if len(r.Env) == 0 {600 if s, err := p.Cluster.CoreV1().Secrets(p.AppNamespace(r.App)).Get(
601 context.TODO(), fmt.Sprintf("release-%s", kr.ObjectMeta.Name), am.GetOptions{},
602 ); err == nil {
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.