Skip to content

Instantly share code, notes, and snippets.

@ostretsov
Created July 22, 2023 03:17
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 ostretsov/6a9f5db1e05ff35dbaf7373233d8665c to your computer and use it in GitHub Desktop.
Save ostretsov/6a9f5db1e05ff35dbaf7373233d8665c to your computer and use it in GitHub Desktop.
package main
import (
"context"
)
func Example_cancellationOrder() {
parentCtx, cancelParentCtx := context.WithCancel(context.Background())
//_, cancelChildCtx = context.WithCancel(parentCtx)
_, _ = context.WithCancel(parentCtx)
cancelParentCtx()
//cancelChildCtx() // go vet будет ругаться, если её не вызвать
// Output:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment