Open qinyuguang opened 3 hours ago
1.22
2.7.3/2.7.4
Option Yes
package main import ( "log" "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/util/gconv" ) type Config struct { Enable bool Spec string PoolSize int } func main() { data := gjson.New(`[{"enable":false,"spec":"a"},{"enable":true,"poolSize":1}]`) var configs []*Config if err := gconv.Structs(data, &configs); err != nil { log.Print(err) return } if configs[1].PoolSize == 0 { log.Print("fail") return } log.Print("success") }
Run multiple times, there is a probability that the output fail
all success
If give the struct json tags, there is no problem...
@gqcn
Go version
1.22
GoFrame version
2.7.3/2.7.4
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
What did you see happen?
Run multiple times, there is a probability that the output fail
What did you expect to see?
all success