shared/scriptlet: Don't panic on marshaling uuid.UUID and other non-addressable arrays

Signed-off-by: Max Asnaashari <[email protected]>
This commit is contained in:
Max Asnaashari
2026-10-09 13:43:56 -07:00
parent 1087e5b551
commit ff74747b9a
+8 -1
View File
@@ -103,7 +103,14 @@ func starlarkMarshal(input any, parent *starlark.Dict) (starlark.Value, error) {
case reflect.Array, reflect.Slice:
// We treat arrays and slices of bytes as Starlark bytes.
if v.Type().Elem().Kind() == reflect.Uint8 {
sv = starlark.Bytes(v.Bytes())
if v.Type().Kind() == reflect.Slice {
sv = starlark.Bytes(v.Bytes())
} else {
b := make([]byte, v.Len())
reflect.Copy(reflect.ValueOf(b), v)
sv = starlark.Bytes(b)
}
break
}