Skip to content

Instantly share code, notes, and snippets.

@malisetti
Last active July 24, 2017 08:50
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 malisetti/28cc811311e8a57ebae1aa3c18fe886a to your computer and use it in GitHub Desktop.
Save malisetti/28cc811311e8a57ebae1aa3c18fe886a to your computer and use it in GitHub Desktop.
notes to self
  1. empty select blocks
select {}
  1. if you can't block but have to wait on something, block in another routine
go func() {
  wg.Wait()
}()
go func() {
  <-ctx.Done()
}()
  1. channels are not queues
  2. use errgroup to start things that are needed(together) for something else
  3. write a blocking functions and compose using routines
  4. defers are executed even when panics happen
  5. defer stop the timers
  6. context is easy to use and use it whenever possible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment