packer: Avoid an extra allocation by using clever addressing
This commit is contained in:
parent
7a07802eb4
commit
e851ac5d26
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue