Change-Id: I6a23219a9e05350bdd9205e19165d5944f15de31
GitHub-Last-Rev: 
8c295bf55feaa07cd487e6015029c4682a1480b0
GitHub-Pull-Request: golang/go#69429
Reviewed-on: https://go-review.googlesource.com/c/go/+/612719
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
 
        "encoding"
        "errors"
        "fmt"
+       "maps"
        "os"
        "reflect"
        "sync"
 
        // Create new map with old contents plus new entry.
        m, _ := typeInfoMap.Load().(map[reflect.Type]*typeInfo)
-       newm := make(map[reflect.Type]*typeInfo, len(m))
-       for k, v := range m {
-               newm[k] = v
-       }
+       newm := maps.Clone(m)
        newm[rt] = info
        typeInfoMap.Store(newm)
        return info, nil