Skip to content

Instantly share code, notes, and snippets.

@no-glue
Forked from alehano/Golang decorator
Last active August 29, 2015 14:13
Show Gist options
  • Save no-glue/25f67a0e41e394701b3d to your computer and use it in GitHub Desktop.
Save no-glue/25f67a0e41e394701b3d to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func decorator(f func(s string)) func(s string) {
return func(s string) {
fmt.Println("Started")
f(s)
fmt.Println("Done")
}
}
func doSomething(s string) {
fmt.Println(s)
}
func main() {
decorator(doSomething)("Do something")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment