Merge pull request #1197 from pulumi/ellismg/fix-1196

Fix plugin loading
This commit is contained in:
Joe Duffy 2018-04-14 14:02:36 -07:00 committed by GitHub
commit f8afe0ed41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,7 +295,10 @@ func GetPluginPath(kind PluginKind, name string, version *semver.Version) (strin
return "", "", errors.Wrapf(err, "loading plugin list") return "", "", errors.Wrapf(err, "loading plugin list")
} }
var match *PluginInfo var match *PluginInfo
for _, plugin := range plugins { for _, cur := range plugins {
// Since the value of cur changes as we iterate, we can't save a pointer to it. So let's have a local that
// we can take a pointer to if this plugin is the best match yet.
plugin := cur
if plugin.Kind == kind && plugin.Name == name { if plugin.Kind == kind && plugin.Name == name {
// Always pick the most recent version of the plugin available. Even if this is an exact match, we // Always pick the most recent version of the plugin available. Even if this is an exact match, we
// keep on searching just in case there's a newer version available. // keep on searching just in case there's a newer version available.