Loading dynamictypes/dynamictypes_test.go +14 −0 Original line number Diff line number Diff line Loading @@ -23,3 +23,17 @@ func TestDynamicTypes(t *testing.T) { } } } func getValue() interface{} { return 3 //.1415926 } func TestAssignment(t *testing.T) { v := getValue() a, ok := v.(int) if ok == false { t.Logf("failed to convert") } else { t.Logf("%d", a) } } Loading
dynamictypes/dynamictypes_test.go +14 −0 Original line number Diff line number Diff line Loading @@ -23,3 +23,17 @@ func TestDynamicTypes(t *testing.T) { } } } func getValue() interface{} { return 3 //.1415926 } func TestAssignment(t *testing.T) { v := getValue() a, ok := v.(int) if ok == false { t.Logf("failed to convert") } else { t.Logf("%d", a) } }