v0.11.0
//goroutinectx:ignore is now read strictly: a reason goes after //, and a name goroutinectx does not know is reported. An ignore that silences nothing is now reported as unused, as it was meant to be.
Important
goroutinectx now requires Go 1.27. It required 1.26 before.
Some reports can appear in code that has not changed. Each points at an ignore or directive that did nothing:
- an ignore on a line with no violation, now reported as unused;
- an unknown checker or directive name, such as
//goroutinectx:ignore gorutine; //goroutinectx:ignore errgroupon a conc call. Useconcthere.
//goroutinectx:ignore
(#66)
| Comment | 0.10.0 | 0.11.0 |
|---|---|---|
//goroutinectx:ignore // why |
Silenced nothing: // why was read as a checker |
Ignores every checker |
//goroutinectx:ignore goroutine - why |
Ignores goroutine |
The same. - why is kept for compatibility |
//goroutinectx:ignore intentionally detached |
Silenced nothing, reported as unused | unknown checker "intentionally detached", with the valid names |
//goroutinectx:ignore goroutine,typo |
Ignored goroutine |
Reported, and ignores nothing |
//goroutinectx:ignore conc |
Silenced nothing | Ignores the conc checker |
//goroutinectx:ignore errgroup on a conc call |
Silenced it | Reported as unused. Use conc |
//goroutinectx:ignre |
Did nothing, silently | unknown directive goroutinectx:ignre |
An ignore counts as used only when it silences a report. The check used to consult the ignore before it ran. So an ignore on a clean line was never reported as unused.
//line directives
Ignores, spawner directives and the generated-file skip were keyed by names and lines that a //line directive changes. (#63)
| Case | 0.10.0 | 0.11.0 |
|---|---|---|
An ignore below //line |
Did not silence, and was reported unused | Silences |
A generated file with //line |
Analyzed and reported | Skipped |
Two //line regions whose lines touch |
A spawner directive could attach to the wrong function | Lines are those in the file |
Performance
Looking up what was assigned to a variable walked the whole file, and rebuilt an inspector, on every lookup. It now uses the pass inspector. On a file with many closure reassignments, a run fell from 18.5 s to 1.2 s of CPU. On typical code the difference is within noise. (#64)
Other changes
- Code reads more directly. Duplicated closure checks and a duplicated package match are shared, and needless nil checks are gone. Output is unchanged. (#68, #69, #70, #71)
- The agent skills vendored from declscope are updated to 0.15.0, which adds
declscope-authoring. (#72)
Install
mise use "github:mpyw/goroutinectx@0.11.0"Full changelog: v0.10.0...v0.11.0
Changelog
- 27a900d Bump declscope version
- 340d3e3 chore(deps): bump declscope to 0.12.0, and turn on rules.unused: strict (#56)
- a94d68a fix: read //goroutinectx:ignore as declscope reads its ignore (#66)
- a6f23f2 fix: use unadjusted positions so //line directives do not move directives (#63)
- 29dee91 perf: look up assignments with the pass inspector (#64)
- 5a3fb0b refactor: adopt Go 1.27 syntax and require Go 1.27
- 21c7716 refactor: drop nil checks that a comma-ok assertion already makes (#71)
- ab051c1 refactor: reuse the closure checks and the package path match (#70)
- c89cfa0 refactor: say searches and splits with slices and strings (#68)
- bcf3f7b refactor: walk assignments through two iterators in probe (#69)