Skip to content

Instantly share code, notes, and snippets.

@drborges
Created February 29, 2016 11:59
Show Gist options
  • Select an option

  • Save drborges/12268deaabb9947df9b4 to your computer and use it in GitHub Desktop.

Select an option

Save drborges/12268deaabb9947df9b4 to your computer and use it in GitHub Desktop.
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