gf icon indicating copy to clipboard operation
gf copied to clipboard

[v2.7.0] gconv.Struct is not compatible with previous versions

Open qinyuguang opened this issue 10 months ago • 1 comments

Example

package main

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/util/gconv"
	"github.com/gogf/gf/v2/util/gutil"
)

type Something struct {
	Value string `json:"value2"`
}

func main() {
	m1 := g.Map{
		"Value2": "hello",
	}

	var s1 *Something
	_ = gconv.Struct(m1, &s1)

	gutil.DumpWithType(s1)
}

Result

gf2.6.4

*main.Something(1) {
    Value: string(5) "hello",
}

gf2.7.0

*main.Something(1) {
    Value: string(5) "",
}

qinyuguang avatar Apr 23 '24 08:04 qinyuguang