From 72112ccae23591c86f6965ca22b260b947373ffe Mon Sep 17 00:00:00 2001 From: Tommy McNeely Date: Mon, 6 Jan 2020 12:50:12 -0700 Subject: [PATCH] Make the path assignment less confusing --- config.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/config.go b/config.go index 145a2fca5..c226b49ec 100644 --- a/config.go +++ b/config.go @@ -132,10 +132,9 @@ func (c *config) discoverExternalComponents(path string) error { return err } for plugin, path := range pluginPaths { - plugin := plugin - path := path + newPath := path // this needs to be stored in a new variable for the func below c.Builders[plugin] = func() (packer.Builder, error) { - return c.pluginClient(path).Builder() + return c.pluginClient(newPath).Builder() } externallyUsed = append(externallyUsed, plugin) } @@ -150,10 +149,9 @@ func (c *config) discoverExternalComponents(path string) error { return err } for plugin, path := range pluginPaths { - plugin := plugin - path := path + newPath := path // this needs to be stored in a new variable for the func below c.PostProcessors[plugin] = func() (packer.PostProcessor, error) { - return c.pluginClient(path).PostProcessor() + return c.pluginClient(newPath).PostProcessor() } externallyUsed = append(externallyUsed, plugin) } @@ -168,10 +166,9 @@ func (c *config) discoverExternalComponents(path string) error { return err } for plugin, path := range pluginPaths { - plugin := plugin - path := path + newPath := path // this needs to be stored in a new variable for the func below c.Provisioners[plugin] = func() (packer.Provisioner, error) { - return c.pluginClient(path).Provisioner() + return c.pluginClient(newPath).Provisioner() } externallyUsed = append(externallyUsed, plugin) }