Skip to content

Instantly share code, notes, and snippets.

@wsong
Created January 25, 2017 19:30
Show Gist options
  • Save wsong/024fdb01974c47de15998c3ccfa6099c to your computer and use it in GitHub Desktop.
Save wsong/024fdb01974c47de15998c3ccfa6099c to your computer and use it in GitHub Desktop.
func retryLoop() {
var lastError error
for i := 0; i < 10; i++ {
val, lastError := doSomething()
if lastError == nil {
break
}
}
return lastError
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment