2022-02-23 00:39:01 +00:00
|
|
|
package main
|
|
|
|
|
2022-02-23 22:13:00 +00:00
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
func MergeEnvMap(parent, child map[string]string) map[string]string {
|
2022-02-23 00:55:41 +00:00
|
|
|
result := map[string]string{}
|
|
|
|
|
2022-02-23 00:39:01 +00:00
|
|
|
for key, value := range parent {
|
|
|
|
result[key] = value
|
|
|
|
}
|
|
|
|
|
|
|
|
for key, value := range child {
|
|
|
|
result[key] = value
|
|
|
|
}
|
|
|
|
|
2022-02-23 00:55:41 +00:00
|
|
|
return result
|
2022-02-23 00:39:01 +00:00
|
|
|
}
|
2022-02-23 22:13:00 +00:00
|
|
|
|
|
|
|
func EnvMapToList(envMap map[string]string) []string {
|
|
|
|
envList := []string{}
|
|
|
|
for name, value := range envMap {
|
|
|
|
envList = append(envList, fmt.Sprintf("%s=%s", name, value))
|
|
|
|
}
|
|
|
|
|
|
|
|
return envList
|
|
|
|
}
|