mirror of https://github.com/golang/go.git
text/template/parse: specify slice capacity in Pipenode.CopyPipe()
The required vars slice capacity is known so it can be specified before appending.
Change-Id: Ifa2fe97602e84198c4d01e5a1b0529f3f65f2df1
GitHub-Last-Rev: a0580df208
GitHub-Pull-Request: golang/go#34613
Reviewed-on: https://go-review.googlesource.com/c/go/+/197997
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
parent
8e032b917a
commit
f91c850be6
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue