package lostcancel
import "golang.org/x/tools/go/analysis/passes/lostcancel"
Package lostcancel defines an Analyzer that checks for failure to call a context cancellation function.
Analyzer lostcancel
lostcancel: check cancel func returned by context.WithCancel is called
The cancellation function returned by context.WithCancel, WithTimeout, WithDeadline and variants such as WithCancelCause must be called, or the new context will remain live until its parent context is cancelled. (The background context is never cancelled.)
Index ¶
Variables ¶
var Analyzer = &analysis.Analyzer{ Name: "lostcancel", Doc: analysisutil.MustExtractDoc(doc, "lostcancel"), URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/lostcancel", Run: run, Requires: []*analysis.Analyzer{ inspect.Analyzer, ctrlflow.Analyzer, }, }
Source Files ¶
doc.go lostcancel.go
Directories ¶
Path | Synopsis |
---|---|
go/analysis/passes/lostcancel/cmd | |
go/analysis/passes/lostcancel/cmd/lostcancel | The lostcancel command applies the golang.org/x/tools/go/analysis/passes/lostcancel analysis to the specified packages of Go source code. |
- Version
- v0.30.0 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 3 hours ago –
Tools for package owners.