Created
November 21, 2016 23:35
-
-
Save mohae/a240d0f8103f45d798f5554f47adb973 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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