Closed KevinJoiner closed 8 months ago
When using struct tags that are missing closing brackets, generation hangs indefinitely. Though this is an invalid tag, it would be helpful to return an error or skip the malformed field.
https://go.dev/play/p/oqXL9XRwykg
package main import ( "fmt" "github.com/brianvoe/gofakeit/v7" ) // Create structs with random injected data type Foo struct { RandStr string `fake:"{randomstring:[hello,world}"` // missing closing `]` // RandStr string `fake:"{randomstring:[hello,world]}"` } func main() { var f Foo err := gofakeit.Struct(&f) if err != nil { panic(err) } fmt.Println(f.RandStr) fmt.Println("finished") }
I actually agree with that!
Let me see if i can add a check for it easily
Fixed v7.0.1
When using struct tags that are missing closing brackets, generation hangs indefinitely. Though this is an invalid tag, it would be helpful to return an error or skip the malformed field.
https://go.dev/play/p/oqXL9XRwykg