no more index check
This commit is contained in:
13
lazy.go
13
lazy.go
@@ -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))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user