Skip to content

Instantly share code, notes, and snippets.

@icodeface
Created August 31, 2021 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icodeface/89aaf03d763c11ed204c1016cca8ac30 to your computer and use it in GitHub Desktop.
Save icodeface/89aaf03d763c11ed204c1016cca8ac30 to your computer and use it in GitHub Desktop.
context
for {
select {
case <-Ctx.Done():
return
default:
for i := 0; i < 100; i++ {
// 业务逻辑
if err := doSomethingWith(Ctx); err != nil {
log.Error(err)
break
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment