LabscoMCP early access ↗

When the caller gives up and walks away, the work behind the request should stop too. This is the Go plumbing that carries that cancellation, and a deadline, down through every layer.

WHEN TO USE

SCOPE

USE FOR

  • Propagate the same context from an HTTP handler through the service and database layers.
  • Choose correctly between context.Background, context.TODO, and context.WithoutCancel.
  • Add a timeout or deadline to a downstream call with WithTimeout or WithDeadline.
  • Store a request-scoped value like a request ID safely using an unexported key type.
  • Keep a background cleanup task running after its parent HTTP request has already returned.

NOT FOR

  • Not for code that simply accepts ctx as a first parameter with no propagation question.