Commit e851ac5d authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Avoid an extra allocation by using clever addressing

parent 7a07802e
......@@ -126,8 +126,8 @@ func ParseTemplate(data []byte) (t *Template, err error) {
t.PostProcessors[i] = make([]rawPostProcessorConfig, len(rawPP))
configs := t.PostProcessors[i]
for j, pp := range rawPP {
var config rawPostProcessorConfig
if err := mapstructure.Decode(pp, &config); err != nil {
config := &configs[j]
if err := mapstructure.Decode(pp, config); err != nil {
if merr, ok := err.(*mapstructure.Error); ok {
for _, err := range merr.Errors {
errors = append(errors, fmt.Errorf("Post-processor #%d.%d: %s", i+1, j+1, err))
......@@ -145,8 +145,6 @@ func ParseTemplate(data []byte) (t *Template, err error) {
}
config.rawConfig = pp
configs[j] = config
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment