rlp: using maps.Clone

This commit is contained in:
cuiweixie 2024-04-02 12:56:11 +08:00
parent 8c5576b1ac
commit 9653c0f8d1

View file

@ -18,6 +18,7 @@ package rlp
import (
"fmt"
"maps"
"reflect"
"sync"
"sync/atomic"
@ -90,10 +91,7 @@ func (c *typeCache) generate(typ reflect.Type, tags rlpstruct.Tags) *typeinfo {
}
// Copy cur to next.
c.next = make(map[typekey]*typeinfo, len(cur)+1)
for k, v := range cur {
c.next[k] = v
}
c.next = maps.Clone(cur)
// Generate.
info := c.infoWhileGenerating(typ, tags)