cmd/vet: doesn't allow discarded cancel function on subcontexts #51160
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go version go1.16.5 darwin/amd64
What did you do?
go vet
fails on discarded cancel function in child context, even though thecontext
package states parent cancellation cancels all children.Getting
the cancel function returned by context.WithDeadline should be called, not discarded, to avoid a context leak
A very simplified example
The text was updated successfully, but these errors were encountered: