Golang Context

TL;DR

  1. Using context to cancel and timeout, deadline for expensive operation.
  2. Using context to carry information, such as request ID in logging chain.
  3. The http package won’t carry user customized context value b/w client and server.

Resource

Lecture link

  • The context.Background() is used as root context.
  • The code examples captured from the lecture.
0%