Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{
Name: "channelcheck",
Doc: "reports channel blocking issues",
Run: run,
Flags: flagSet,
}
Functions ¶
Types ¶
type ChannelCheckPlugin ¶
type ChannelCheckPlugin struct{}
ChannelCheckPlugin is the golangci-lint module-plugin entry point. Its configuration lives in the package-level settings var (populated by New), which is the single source of truth — shared with the standalone cmd/wormhole-lint multichecker, which populates the same var via flags.
func (*ChannelCheckPlugin) BuildAnalyzers ¶
func (f *ChannelCheckPlugin) BuildAnalyzers() ([]*analysis.Analyzer, error)
func (*ChannelCheckPlugin) GetLoadMode ¶
func (f *ChannelCheckPlugin) GetLoadMode() string
type EscapeKind ¶
type EscapeKind int
EscapeKind classifies a non-send CommClause in a select, describing what kind of escape valve (if any) it provides for a sibling send.
const ( EscapeNone EscapeKind = iota EscapeTimer // receive on <-chan time.Time EscapeDefaultWithCode // default: with non-empty body EscapeEmptyDefault // default: with empty body EscapeContextDone // receive on a call to (context.Context).Done() EscapeOther // any other clause in the statement )
type SelectAnalysis ¶
type SelectAnalysis struct {
Sends []*ast.SendStmt // SendStmts that are direct CommClause heads
Escapes []EscapeKind // one entry per non-send clause (excludes EscapeNone)
EmptyDefaultPos token.Pos // position of an empty default clause, or NoPos if none
ContextDonePos token.Pos // position of a <-ctx.Done() clause, or NoPos if none
}
SelectAnalysis is the result of inspecting a select statement.
type Settings ¶
type Settings struct {
CheckUnbufferedChannels bool // Enable/disable checking for unbuffered channel creation.
CheckBufferAmount uint64 // The amount that can be in a buffer. 0 means don't do this check.
CheckBlockingSends bool // Enable/disable checking for blocking sends without default/timeout.
CheckEmptyDefault bool // Enable/disable the (advisory) empty-default-drops-the-send check.
IgnoreChannelsByName []string // Channel/field names whose direct sends are exempt from the blocking-send check.
// contains filtered or unexported fields
}
Settings holds the configuration for the channelcheck linter.
Click to show internal directories.
Click to hide internal directories.