Loading reflection/reflection.go 0 → 100644 +8 −0 Original line number Diff line number Diff line package reflection type example struct { f1 string x1 int x2 int f2 string } reflection/reflection_test.go 0 → 100644 +16 −0 Original line number Diff line number Diff line package reflection import ( "reflect" "testing" ) func TestReflection1(t *testing.T) { e := example{} eT := reflect.TypeOf(e) t.Logf("%s", eT) for i := 0; i < eT.NumField(); i++ { f := eT.Field(i) t.Logf("field: %s - %s", f.Name, f.Type) } } Loading
reflection/reflection.go 0 → 100644 +8 −0 Original line number Diff line number Diff line package reflection type example struct { f1 string x1 int x2 int f2 string }
reflection/reflection_test.go 0 → 100644 +16 −0 Original line number Diff line number Diff line package reflection import ( "reflect" "testing" ) func TestReflection1(t *testing.T) { e := example{} eT := reflect.TypeOf(e) t.Logf("%s", eT) for i := 0; i < eT.NumField(); i++ { f := eT.Field(i) t.Logf("field: %s - %s", f.Name, f.Type) } }