Skip to content

Instantly share code, notes, and snippets.

@tonyhb
Last active August 29, 2015 14:05
Show Gist options
  • Save tonyhb/8153e1fe10891c68a8c5 to your computer and use it in GitHub Desktop.
Save tonyhb/8153e1fe10891c68a8c5 to your computer and use it in GitHub Desktop.
Using variable functions to make testing easier
// By assigning next to a variable we can swap out the hello() function in testing with a custom
// implementation
var h = hello
func main() {
fmt.Println(n())
}
func hello() string {
return "world"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment