sort output of Write/Marshal

This commit is contained in:
Alex Quick
2017-09-16 17:58:01 -04:00
parent 9f04f40640
commit 3dd2dbe832
2 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import (
"os"
"os/exec"
"regexp"
"sort"
"strings"
)
@ -165,6 +166,7 @@ func Marshal(envMap map[string]string) (string, error) {
for k, v := range envMap {
lines = append(lines, fmt.Sprintf(`%s="%s"`, k, doubleQuoteEscape(v)))
}
sort.Strings(lines)
return strings.Join(lines, "\n"), nil
}