Last active
August 29, 2015 14:05
-
-
Save tonyhb/8153e1fe10891c68a8c5 to your computer and use it in GitHub Desktop.
Using variable functions to make testing easier
This file contains 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
// 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