mirror of
https://github.com/golang/go.git
synced 2024-09-21 10:28:27 +00:00
text/template: make use of maps.Copy for Template.Clone
Change-Id: I1da668223b599867afe5483384b458482624adc5
GitHub-Last-Rev: 0a6bd6e84a
GitHub-Pull-Request: golang/go#69423
Reviewed-on: https://go-review.googlesource.com/c/go/+/612717
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
4c0f098533
commit
fc97288e26
@ -5,6 +5,7 @@
|
||||
package template
|
||||
|
||||
import (
|
||||
"maps"
|
||||
"reflect"
|
||||
"sync"
|
||||
"text/template/parse"
|
||||
@ -102,12 +103,8 @@ func (t *Template) Clone() (*Template, error) {
|
||||
}
|
||||
t.muFuncs.RLock()
|
||||
defer t.muFuncs.RUnlock()
|
||||
for k, v := range t.parseFuncs {
|
||||
nt.parseFuncs[k] = v
|
||||
}
|
||||
for k, v := range t.execFuncs {
|
||||
nt.execFuncs[k] = v
|
||||
}
|
||||
maps.Copy(nt.parseFuncs, t.parseFuncs)
|
||||
maps.Copy(nt.execFuncs, t.execFuncs)
|
||||
return nt, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user