Skip to content

Instantly share code, notes, and snippets.

@aarzilli
Created May 16, 2023 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarzilli/f48b5d06c79f682c56ddb7b90e6d309b to your computer and use it in GitHub Desktop.
Save aarzilli/f48b5d06c79f682c56ddb7b90e6d309b to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"reflect"
)
type Bstruct struct {
n float64
}
func (b *Bstruct) M() {
fmt.Println("hello world")
}
func F() {
reflect.ValueOf(&Bstruct{ 2.0 }).MethodByName("M").Call(nil)
}
var f = F
func main() {
f()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment