-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
Background: the recursiveiter analyzer reports subtly incorrect definitions of iterators over recursive data structures that lead to poor asymptotic performance. It has been included in gopls for over a year.
It does not trigger very often, but it does report a serious problem with high confidence, and is cheap to run. Here's a typical finding:
78 func allYamlNodes(n *yaml.Node) iter.Seq[*yaml.Node] {
79 return func(yield func(*yaml.Node) bool) {
80 if !yield(n) {
81 return
82 }
83 for _, n2 := range n.Content {
84 for n3 := range allYamlNodes(n2) { // "inefficient recursion in iterator allYamlNodes"
85 if !yield(n3) {
86 return
87 }
88 }
89 }
90 }
91 }
More:
- https://go-mod-viewer.appspot.com/github.com/storacha/go-ucanto@v0.7.2/core/delegation/delegation.go#L190
- https://go-mod-viewer.appspot.com/github.com/anacrolix/torrent@v1.61.0/metainfo/file-tree.go#L116
- https://go-mod-viewer.appspot.com/github.com/creachadair/ffs@v0.17.3/storage/monitor/monitor.go#L165
Proposal: we propose to move this analyzer to a public package and include it in the cmd/vet suite.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.