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
retStructs := make([]any, 0)
for x := 0; x < filled.Len(); x++ {
retStructs = append(retStructs, filled.Index(x).Interface())
fl := filled.Len()
retStructs := make([]any, fl)
for x := 0; x < fl; x++ {
retStructs[x] = filled.Index(x).Interface()
}
return &StructMock{