Skip to content

Instantly share code, notes, and snippets.

@mohae
Created November 21, 2016 23:35
Show Gist options
  • Select an option

  • Save mohae/4d2fe8b9c4bacbc1391b8acb186e469a to your computer and use it in GitHub Desktop.

Select an option

Save mohae/4d2fe8b9c4bacbc1391b8acb186e469a to your computer and use it in GitHub Desktop.
package main
import "fmt"
var foo = map[string]func(){}
func init() {
foo["a"] = a
foo["b"] = b
}
func b() {
fmt.Print("world\n")
}
func a() {
fmt.Print("Hello")
foo["b"]()
}
func main() {
a()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment