[BUG] Struct().Fill() is not correctly handling nested structures
bigfoot31 opened this issue · comments
Probhonjon Baruah commented
Describe the bug
goroutine stack exceeds 1000000000-byte limit
To Reproduce
type A struct {
children []*A
}
tmp := A{}
f.Struct().Fill(&tmp)
Expected behavior
A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
- OS: macOS 12.2.1
go version
output: go version go1.17.3 darwin/amd64
Jonathan Schweder commented
@bigfoot31 this issue is quite old now and we have tests to validate nested structures, would you mind check if this error happens with the newest version? If still happens, can you provide a complete code sample you are using?
Gregory Boddin commented
It sill happens on the last tagged version and the master branch
package main
import (
"github.com/jaswdr/faker"
)
type A struct {
ChildrenType1 []*A
}
func main() {
tmp := A{}
faker.New().Struct().Fill(&tmp)
}
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020260408 stack=[0xc020260000, 0xc040260000]
fatal error: stack overflow
Gregory Boddin commented
Tips : if you don't care about the field :
type A struct {
ChildrenType1 []*A `fake:"skip"`
}
Jonathan Schweder commented
I'm taking a look on this