From a0580df208a1d498968138d63508ae4e30df2ec5 Mon Sep 17 00:00:00 2001 From: Pantelis Sampaziotis Date: Mon, 30 Sep 2019 18:41:13 +0300 Subject: [PATCH] text/template/parse: preallocate slice in Pipenode.CopyPipe() --- src/text/template/parse/node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/template/parse/node.go b/src/text/template/parse/node.go index 1174a4b970..74552c293f 100644 --- a/src/text/template/parse/node.go +++ b/src/text/template/parse/node.go @@ -187,7 +187,7 @@ func (p *PipeNode) CopyPipe() *PipeNode { if p == nil { return p } - var vars []*VariableNode + vars := make([]*VariableNode, 0, len(p.Decl)) for _, d := range p.Decl { vars = append(vars, d.Copy().(*VariableNode)) }