>>yes, Is there any library code in golang that helps me to read out
interface{}'s type information?
Yes, there is https://golang.org/pkg/reflect
For example:
getType(0)
getType("hello string")
func getType(v interface{}){
t := reflect.TypeOf(v)
fmt.Printf("type is %s", t)
}
On Tuesday,
I need to call some generic functions with types that are now known at
compile time. Is it possible to do this?
See the code below (vastly reduced).
// fv is a function that returns an unknown type
func Do(fv reflect.Value){
// get the first returned type by function fv
vt :=