例如:
func compare(a interface{}, b interface{}) {
if a > b {
fmt.Printf("%v is bigger than %v", a, b)
}
}
Run Code Online (Sandbox Code Playgroud)
但最后,我得到了编译器错误:
cannot compare a > b (operator > not defined for interface{})compiler
Run Code Online (Sandbox Code Playgroud)