Skip to content

Commit

Permalink
remove unneeded array
Browse files Browse the repository at this point in the history
  • Loading branch information
djelusic committed Oct 14, 2021
1 parent 9cddf0f commit eb85b95
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions workspace/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,14 @@ func (f *Function) addDefaults() {
// which are ordered by priority, from highest to lowest
func (f *Function) mergeEnv(sources ...map[string]string) bool {
// gather all keys
keysMap := make(map[string]bool)
keys := make(map[string]bool)
for _, s := range sources {
for k := range s {
keysMap[k] = true
keys[k] = true
}
}
var keys []string
for k := range keysMap {
keys = append(keys, k)
}
changed := false
for _, k := range keys {
for k := range keys {
// apply values according to priority
for _, s := range sources {
v, ok := s[k]
Expand All @@ -84,7 +80,7 @@ func (f *Function) mergeEnv(sources ...map[string]string) bool {
}
// remove old variables
for k := range f.Env {
if _, ok := keysMap[k]; !ok {
if _, ok := keys[k]; !ok {
delete(f.Env, k)
changed = true
}
Expand Down

0 comments on commit eb85b95

Please sign in to comment.