-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
context: prevent creation of invalid contexts
This commit makes it impossible to create derived contexts with nil parents. Previously it was possible to create derived contexts with nil parents, and invalid contexts could propogate through the program. Eventually this can cause a panic downstream, which is difficult to trace back to the source of the error. Although `WithCancel` and `WithDeadline` already panic if `parent` is `nil`, this adds explicit checks to give a useful message in the panic. Fixes #37908 Change-Id: I70fd01f6539c1b0da0e775fc5457e32e7075e52c GitHub-Last-Rev: 1b7dadd GitHub-Pull-Request: #37898 Reviewed-on: https://go-review.googlesource.com/c/go/+/223777 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information
1 parent
61ce82a
commit 0205790
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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