accounts/abi/abigen: prealloc slice

This commit is contained in:
cuiweixie 2026-01-18 18:49:22 +08:00
parent ef815c59a2
commit c1edd8397a
No known key found for this signature in database
GPG key ID: 16DF64EE15E495A3

View file

@ -276,7 +276,7 @@ func parseLibraryDeps(unlinkedCode string) (res []string) {
// onItem on each. If the callback returns an error, iteration is halted and // onItem on each. If the callback returns an error, iteration is halted and
// the error is returned from iterSorted. // the error is returned from iterSorted.
func iterSorted[V any](inp map[string]V, onItem func(string, V) error) error { func iterSorted[V any](inp map[string]V, onItem func(string, V) error) error {
var sortedKeys []string sortedKeys := make([]string, 0, len(inp))
for key := range inp { for key := range inp {
sortedKeys = append(sortedKeys, key) sortedKeys = append(sortedKeys, key)
} }