Suppose I have the following:
package main
import "fmt"
type I1 interface {
m1()
}
func f1() {
fmt.Println("dosomething")
}
func main() {
var obj I1
obj.m1 = f1
obj.m1()
}
This generates the error
./empty.go:16: cannot assign to obj.m1
Why can't I assign to 'method fields'?
In C, I can just pass around function pointers. What is the equivalent in Go?