Skip to content

Instantly share code, notes, and snippets.

@SirEdvin
Last active May 31, 2018 09:36
Show Gist options
  • Save SirEdvin/e621e1b1ca6342cf033a8e9720294574 to your computer and use it in GitHub Desktop.
Save SirEdvin/e621e1b1ca6342cf033a8e9720294574 to your computer and use it in GitHub Desktop.
type Node interface {
Prepare()
Run()
}
func doSomeWork(n Node) {
// ...
n.Prepare()
// ...
n.Run()
// ...
}
type Command struct {}
func (Command) Prepare() {
// ...
}
func (Command) Run() {
// ...
}
type Spawner struct {}
func (Spawner) Prepare() {
// ...
}
func (Spawner) Run() {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment