Merge pull request #32364 from aaronlehmann/preserve-env-order

cli: Preserve order of environment variables
This commit is contained in:
Vincent Demeester 2017-04-06 14:25:29 +02:00 committed by GitHub
commit fbddea6cac
1 changed files with 9 additions and 8 deletions

View File

@ -524,20 +524,21 @@ func updateLabels(flags *pflag.FlagSet, field *map[string]string) {
}
func updateEnvironment(flags *pflag.FlagSet, field *[]string) {
envSet := map[string]string{}
for _, v := range *field {
envSet[envKey(v)] = v
}
if flags.Changed(flagEnvAdd) {
envSet := map[string]string{}
for _, v := range *field {
envSet[envKey(v)] = v
}
value := flags.Lookup(flagEnvAdd).Value.(*opts.ListOpts)
for _, v := range value.GetAll() {
envSet[envKey(v)] = v
}
}
*field = []string{}
for _, v := range envSet {
*field = append(*field, v)
*field = []string{}
for _, v := range envSet {
*field = append(*field, v)
}
}
toRemove := buildToRemoveSet(flags, flagEnvRemove)