Created
July 22, 2023 03:17
-
-
Save ostretsov/6a9f5db1e05ff35dbaf7373233d8665c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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