provider/vsphere: remove incorrect getSnapshot pattern #4920

Merged
merged 2 commits into from Mar 30, 2016

Conversation

Projects
None yet
2 participants
Contributor

davecheney commented Mar 30, 2016

Updates LP 1563628

The env = env.getSnapshot() pattern was wrong. It provided the same guarentee as

func (e env) Method() { .. }

And was just as incorrect. This was spotted with a recent addition to go vet.

(Review request: http://reviews.vapour.ws/r/4359/)

davecheney added some commits Mar 30, 2016

provider/vsphere: fix copy mutex by value error
The pattern `env = env.getSnapshot()` was broken as it would return a
shallow copy of the environ value, including its lock. However all the
fields referenced by pointers would point to the same instnace, but with
the lock no longer protecting access.

The `env = env.getSnapshot()` pattern is identical to declaring the
method on on `env`, not `*env`, but the pattern hid this incorrect
behaviour until a recent improvement to go vet spotted it.
Contributor

davecheney commented Mar 30, 2016

$$merge$$

Contributor

jujubot commented Mar 30, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 8ab7303 into juju:master Mar 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment