Created
March 2, 2014 06:57
-
-
Save rolaveric/9302960 to your computer and use it in GitHub Desktop.
An example of a function type in Go
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
func DoSomething(callback func(message string) error) { | |
// Good thing I know this function will take a message string and return a single error response | |
err := callback("Did something good!") | |
if err != nil { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment