Update reflect.go

This commit is contained in:
Felix Lange 2025-08-07 16:15:23 +02:00 committed by GitHub
parent fb44e66e60
commit d29e98d9fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -90,7 +90,7 @@ func reflectIntType(unsigned bool, size int) reflect.Type {
// mustArrayToByteSlice creates a new byte slice with the exact same size as value
// and copies the bytes in value to the new slice.
func mustArrayToByteSlice(value reflect.Value) reflect.Value {
slice := reflect.MakeSlice(reflect.TypeFor[[]byte](), value.Len(), value.Len())
slice := reflect.ValueOf(make([]byte, value.Len()))
reflect.Copy(slice, value)
return slice
}