Skip to content

Conversation

@NathanBaulch
Copy link

@NathanBaulch NathanBaulch commented Oct 21, 2025

I noticed some prealloc opportunities aren't detected when nested inside if/for blocks, not in the top level function body. Looking at the code, it turns out only ast.FuncDecl bodies are processed and the statement blocks within are skipped.

This simple PR improves detection by walking all ast.BlockStmt bodies at any level.

I've tested against ~20k assorted go files on my local machine with and without this PR. No existing detections were lost and ~190 new detections were found (all in nested blocks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant