We have a self-referential Failure type defined here. The actual struct is more complicated, but it looks like the one in the below script:
package main
import (
"github.com/brianvoe/gofakeit/v6"
)
// Failure is a generated struct from a proto definition.
type Failure struct {
Cause *Failure // Can't add fakeit ignore tag here because this is a generated field.
}
func main() {
var obj Failure
_ = gofakeit.Struct(&obj) // stack overflow
}
This will cause a stack overflow due to the circular dependency. However, I can't easily ignore the field because I can't edit the struct definitions since they are generated. There may be some ways, but I'd rather avoid it if possible since it will likely add a new step to our proto generation process.
Is there a way I can state during the invocation of gofakeit.Struct that this specific field should be ignored so that I don't need to modify the struct definition itself?
We have a self-referential
Failure
type defined here. The actual struct is more complicated, but it looks like the one in the below script:This will cause a stack overflow due to the circular dependency. However, I can't easily ignore the field because I can't edit the struct definitions since they are generated. There may be some ways, but I'd rather avoid it if possible since it will likely add a new step to our proto generation process.
Is there a way I can state during the invocation of
gofakeit.Struct
that this specific field should be ignored so that I don't need to modify the struct definition itself?Thank you!