Skip to content

Conversation

@kolkov
Copy link
Owner

@kolkov kolkov commented Dec 19, 2025

Summary

Changes

New Files

  • cmd/racedetector/instrument/escape.go - Escape analysis parser
  • cmd/racedetector/instrument/escape_test.go - Unit tests
  • cmd/racedetector/instrument/escape_integration_test.go - Integration tests
  • cmd/racedetector/toolexec.go - Toolexec command

Modified Files

  • cmd/racedetector/build.go - Escape analysis integration
  • cmd/racedetector/instrument/instrument.go - InstrumentOptions support
  • cmd/racedetector/instrument/visitor.go - EscapeInfo in options
  • cmd/racedetector/main.go - Added toolexec command
  • Documentation: CHANGELOG.md, README.md, ROADMAP.md, USAGE_GUIDE.md

Test Plan

Fixes: #17

Integrate compiler escape analysis to reduce false positives:
- Add escape.go parser for 'go build -gcflags=-m' output
- Skip instrumentation for stack-local variables (don't escape)
- Reduce instrumentation by 30-50% on real codebases

Add toolexec command for go build integration:
- racedetector toolexec for use with go build -toolexec
- Automatically skip stdlib and internal packages
- Support escape analysis in toolexec mode

Testing on zygomys (issue #17):
- lexer.go: 14 writes/35 reads -> 9 writes/18 reads
- Named return value false positives eliminated
- Remaining races confirmed as real concurrent access

Fixes: #17
- CHANGELOG.md: Add v0.8.0 section with escape analysis and toolexec
- README.md: Add toolexec usage example and v0.8.0 note
- USAGE_GUIDE.md: Add toolexec command and escape analysis sections
- ROADMAP.md: Update current status to v0.8.0, add release history
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 32.40741% with 146 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.30%. Comparing base (cb7a8f9) to head (bb6cb95).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/racedetector/toolexec.go 0.00% 100 Missing ⚠️
cmd/racedetector/instrument/escape.go 60.29% 27 Missing ⚠️
cmd/racedetector/build.go 37.50% 8 Missing and 2 partials ⚠️
cmd/racedetector/instrument/visitor.go 69.23% 5 Missing and 3 partials ⚠️
cmd/racedetector/instrument/instrument.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
- Coverage   72.17%   69.30%   -2.87%     
==========================================
  Files          26       28       +2     
  Lines        2706     2913     +207     
==========================================
+ Hits         1953     2019      +66     
- Misses        639      777     +138     
- Partials      114      117       +3     
Flag Coverage Δ
unittests 69.30% <32.40%> (-2.87%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/racedetector/instrument/instrument.go 78.72% <83.33%> (-2.68%) ⬇️
cmd/racedetector/instrument/visitor.go 72.45% <69.23%> (+0.67%) ⬆️
cmd/racedetector/build.go 54.04% <37.50%> (-1.40%) ⬇️
cmd/racedetector/instrument/escape.go 60.29% <60.29%> (ø)
cmd/racedetector/toolexec.go 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb7a8f9...bb6cb95. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@kolkov kolkov merged commit 73395f3 into main Dec 19, 2025
14 checks passed
@kolkov kolkov deleted the feat/v0.8.0-escape-analysis branch December 19, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants