terraform: fix go vet issues by not using *c to copy

This commit is contained in:
Mitchell Hashimoto 2016-10-12 19:47:21 +08:00
parent 70cee9c1c6
commit baa59ff75d
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 24 additions and 3 deletions

View File

@ -67,10 +67,31 @@ func newShadowContext(c *Context) (*Context, *Context, Shadow) {
// Create the real context. This is effectively just a copy of
// the context given except we need to modify some of the values
// to point to the real side of a shadow so the shadow can compare values.
real := *c
real.components = componentsReal
real := &Context{
// The fields below are changed.
components: componentsReal,
return &real, shadow, &shadowContextCloser{
// The fields below are direct copies
destroy: c.destroy,
diff: c.diff,
// diffLock - no copy
hooks: c.hooks,
module: c.module,
sh: c.sh,
state: c.state,
// stateLock - no copy
targets: c.targets,
uiInput: c.uiInput,
variables: c.variables,
// l - no copy
parallelSem: c.parallelSem,
providerInputConfig: c.providerInputConfig,
runCh: c.runCh,
shadowErr: c.shadowErr,
}
return real, shadow, &shadowContextCloser{
Components: componentsShadow,
}
}