Created
February 29, 2016 11:59
-
-
Save drborges/12268deaabb9947df9b4 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" | |
| type Any interface{} | |
| type Callback func(data Any) | |
| type CallbackDecorator func(Callback) Callback | |
| func Greetings(msg Any) { | |
| fmt.Print("Hello there ", msg) | |
| } | |
| func DecorateWithSymbols(cb Callback) Callback { | |
| return func(data Any) { | |
| fmt.Print("!!!%%%&&& ") | |
| cb(data) | |
| fmt.Print(" &&&%%%!!!") | |
| } | |
| } | |
| func main() { | |
| greeter := DecorateWithSymbols(Greetings) | |
| greeter("Diego") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment