no more index check

This commit is contained in:
2025-09-30 16:25:54 -04:00
parent 6326711424
commit 053f5b5fd8

13
lazy.go
View File

@@ -114,6 +114,9 @@ func RandomRows(m Config) (*RowMock, error) {
}, nil }, nil
} }
// we are close to something here but the mock structs aren't it chief. Maybe the users can make() them first?
// I don't love that either tho tbh
// hmmmmm
func RandomStruct(c Config) (*StructMock, error) { func RandomStruct(c Config) (*StructMock, error) {
if c.Example == nil { if c.Example == nil {
return nil, ErrBadExample return nil, ErrBadExample
@@ -148,12 +151,12 @@ func RandomStruct(c Config) (*StructMock, error) {
} }
args[y] = nv args[y] = nv
if x == 0 { // if x == 0 {
nf := filled.Index(x).Field(y) nf := filled.Index(x).Field(y)
if nf.CanSet() { if nf.CanSet() {
filled.Index(x).Field(y).Set(reflect.ValueOf(nv)) filled.Index(x).Field(y).Set(reflect.ValueOf(nv))
}
} }
// }
} }
} }