preserve order when removing module from state

This commit is contained in:
James Bardin 2017-11-08 22:12:35 -05:00
parent ccc9b1d767
commit 14cc654b16
1 changed files with 1 additions and 3 deletions

View File

@ -60,9 +60,7 @@ func (n *EvalDeleteModule) Eval(ctx EvalContext) (interface{}, error) {
log.Printf("[DEBUG] cannot remove module %s, not empty", modulePrefixStr(n.PathValue)) log.Printf("[DEBUG] cannot remove module %s, not empty", modulePrefixStr(n.PathValue))
break break
} }
tail := len(state.Modules) - 1 state.Modules = append(state.Modules[:i], state.Modules[i+1:]...)
state.Modules[i] = state.Modules[tail]
state.Modules = state.Modules[:tail]
break break
} }
} }