Skip to content

Skip leak detection when goroutine stacks can't be parsed - #156

Open
justinhwang wants to merge 1 commit into
masterfrom
justinhwang/tinygo-nostacks
Open

justinhwang wants to merge 1 commit into
masterfrom
justinhwang/tinygo-nostacks

Conversation

@justinhwang

Copy link
Copy Markdown
Contributor

Under runtimes such as TinyGo, runtime.Stack produces no output that goleak can parse, so stack.Current() indexed an empty slice and panicked with "index out of range". Current and All now return stack.ErrNoStacks in that case; Find propagates it, and VerifyNone/VerifyTestMain log a message and skip the check instead of crashing.

The public API is unchanged: the new (Stack, error) signatures are confined to the internal/stack package and the sentinel is internal. parseStacks still panics on malformed (non-empty) traces, so a parse failure on standard Go remains a loud goleak bug rather than a silent skip.

Also add a TinyGo CI job that runs a smoke program (internal/tinygocheck, built only under the tinygo build tag) so this path is exercised on every change. This addresses the concern raised in #72.

Under runtimes such as TinyGo, runtime.Stack produces no output that
goleak can parse, so stack.Current() indexed an empty slice and panicked
with "index out of range". Current and All now return stack.ErrNoStacks
in that case; Find propagates it, and VerifyNone/VerifyTestMain log a
message and skip the check instead of crashing.

The public API is unchanged: the new (Stack, error) signatures are
confined to the internal/stack package and the sentinel is internal.
parseStacks still panics on malformed (non-empty) traces, so a parse
failure on standard Go remains a loud goleak bug rather than a silent
skip.

Also add a TinyGo CI job that runs a smoke program (internal/tinygocheck,
built only under the tinygo build tag) so this path is exercised on every
change. This addresses the concern raised in PR #72.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (503ad8e) to head (16e304b).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #156   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          265       287   +22     
=========================================
+ Hits           265       287   +22     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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