proper slice allocation

This commit is contained in:
2025-09-30 17:32:27 -04:00
parent 5563e93efd
commit 5f24529730

View File

@@ -171,9 +171,10 @@ func RandomStruct(c StructConfig) (*StructMock, error) {
} }
//convert reflect.Value to []any //convert reflect.Value to []any
retStructs := make([]any, 0) fl := filled.Len()
for x := 0; x < filled.Len(); x++ { retStructs := make([]any, fl)
retStructs = append(retStructs, filled.Index(x).Interface()) for x := 0; x < fl; x++ {
retStructs[x] = filled.Index(x).Interface()
} }
return &StructMock{ return &StructMock{