env: use foo= instead of foo="" for empty variables
to improve readability Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
+5
-1
@@ -117,7 +117,11 @@ func (m *Env) writeEnvVar(w io.Writer, value string, name string, args ...any) {
|
||||
if name != "" {
|
||||
value = strings.TrimSpace(value)
|
||||
|
||||
_, _ = fmt.Fprintf(w, "%s%s=%q\n", prefix, name, value)
|
||||
if value == "" {
|
||||
_, _ = fmt.Fprintf(w, "%s%s=\n", prefix, name)
|
||||
} else {
|
||||
_, _ = fmt.Fprintf(w, "%s%s=%q\n", prefix, name, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user