Skip to content

Commit

Permalink
rlp: using maps.Clone (#29434)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuiweixie authored Apr 2, 2024
1 parent fde9044 commit 31e63fc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rlp/typecache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package rlp

import (
"fmt"
"maps"
"reflect"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 31e63fc

Please sign in to comment.