aboutsummaryrefslogtreecommitdiff
path: root/src/text/template
diff options
context:
space:
mode:
authorJes Cok <xigua67damn@gmail.com>2024-09-12 15:46:41 +0000
committerGopher Robot <gobot@golang.org>2024-09-13 17:00:52 +0000
commitfc97288e2607480199755dea9dbd5484f0b4de74 (patch)
tree8243321291926e6f749403508096fd1dcb8784c9 /src/text/template
parent4c0f0985337386e0c0a3aad09251d5ee7f2b145e (diff)
downloadgo-fc97288e2607480199755dea9dbd5484f0b4de74.tar.xz
text/template: make use of maps.Copy for Template.Clone
Change-Id: I1da668223b599867afe5483384b458482624adc5 GitHub-Last-Rev: 0a6bd6e84ac4c744d27d6ac87d877889209f386d 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>
Diffstat (limited to 'src/text/template')
-rw-r--r--src/text/template/template.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/text/template/template.go b/src/text/template/template.go
index 86fd3f122a..78067af2ad 100644
--- a/src/text/template/template.go
+++ b/src/text/template/template.go
@@ -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
}