package main
import (
"fmt"
)
type S struct {
}
func (s *S) Ping() {
fmt.Println("Pong")
}
func main() {
s := &S{}
Do(s.Ping)
}
func Do(f func()) {
// somehow reflect main.S by f Or maybe other ways to do it?
}
Here is the example. I am not sure it is possible to get the caller or not. I would like to make sure if the f is a method and the caller is implemented a specific interface.