Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Struct().Fill() is not correctly handling nested structures #94

Open
bigfoot31 opened this issue Mar 15, 2022 · 4 comments · May be fixed by #136
Open

[BUG] Struct().Fill() is not correctly handling nested structures #94

bigfoot31 opened this issue Mar 15, 2022 · 4 comments · May be fixed by #136
Assignees
Labels
bug Something isn't working

Comments

@bigfoot31
Copy link

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.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS 12.2.1
  • go version output: go version go1.17.3 darwin/amd64
@bigfoot31 bigfoot31 added the bug Something isn't working label Mar 15, 2022
@jaswdr jaswdr self-assigned this May 23, 2022
@jaswdr jaswdr changed the title [BUG] ... [BUG] Struct().Fill() is not correctly handling nested structures Jul 5, 2022
@jaswdr
Copy link
Owner

jaswdr commented Dec 25, 2022

@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?

@gboddin
Copy link

gboddin commented Mar 15, 2023

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

@gboddin
Copy link

gboddin commented Mar 15, 2023

Tips : if you don't care about the field :

type A struct {
	ChildrenType1 []*A `fake:"skip"`
}

@jaswdr
Copy link
Owner

jaswdr commented Mar 22, 2023

I'm taking a look on this

@jaswdr jaswdr linked a pull request Mar 24, 2023 that will close this issue
@jaswdr jaswdr linked a pull request Mar 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants