package utils import ( "reflect" "testing" ) func TestReflect(t *testing.T) { type SubXXXX struct { IntData int StrData string } type XXXX struct { SubXXXX A int B string `json:"b"` } x := XXXX{} typeX := reflect.TypeOf(x) field := typeX.Field(0) t.Log(IsFieldEmbedded(&field)) t.Log(Format4Output(GetStructObjNameIndex(&x, ""), false)) }