Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. Arbitrary := struct {
  2. field1 string
  3. field2 string
  4. }{"a", "b"}
  5.  
  6. fmap := make(map[string]func(string) string)
  7. fmap["fone"] = func(s string) { fmt.Printf("function fone: %s", s) }
  8. fmap["ftwo"] = func(s string) { fmt.Printf("function ftwo: %s", s) }
  9.  
  10. // probably ok, as simple examples go, to this point where reflection needs to be used
  11. Arbitrary.fone = fmap["fone"]
  12.  
  13. Arbitrary.fone("hello")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement