Repository navigation
v0.10.0
Directives are now read exactly as Go reads them, through go/ast.ParseDirective. Only the canonical form is a directive, names match exactly, and a comment that is meant as a directive but spelled differently is reported. The minimum Go version is now 1.26.
Important
This release has three breaking changes.
// goroutinectx:ignoreand// goroutinectx:spawner, with a space after//, used to work. They now have no effect and are reported.- Lookalikes such as
//goroutinectx:ignoredand//goroutinectx:spawnerXused to match. They now have no effect. - Go 1.25 is no longer supported.
See Migrating.
Only //goroutinectx:name is a directive
A directive is a line comment with no space after //, no space after the colon, and a lowercase name. The arguments of ignore read as before: a checker list, a reason after - or //, and empty arguments to ignore every checker.
//goroutinectx:ignore goroutine - the caller cancels this one
go worker()Malformed directives are reported
Any other comment whose text, after // or /*, starts with goroutinectx: once any space is skipped has no effect. It is reported with one message:
worker.go:12:1: malformed goroutinectx directive: write it as //goroutinectx:name
| Comment | 0.9.3 | 0.10.0 |
|---|---|---|
//goroutinectx:ignore |
Directive | Directive |
// goroutinectx:ignore (space or tab after //) |
Directive | Malformed |
//goroutinectx: ignore |
Ordinary comment | Malformed |
/* goroutinectx:ignore */ |
Ordinary comment | Malformed |
//goroutinectx:Ignore |
Ordinary comment | Malformed |
//goroutinectx: |
Ordinary comment | Malformed |
The same applies to spawner. The report matters most there. A spawner that has no effect means the functions passed to it are no longer checked, and nothing else would show it. Prose that mentions a directive partway through a comment is not reported.
Names match exactly
A directive used to match on its prefix, so a longer name counted:
| Comment | 0.9.3 | 0.10.0 |
|---|---|---|
//goroutinectx:ignored |
Ignore every checker | Ordinary comment |
//goroutinectx:spawnerX |
Spawner | Ordinary comment |
These are valid directive syntax with an unknown name, so they are not reported as malformed.
Go 1.26 or later
ast.ParseDirective was added in Go 1.26. The go directive in go.mod is now 1.26.0, and CI tests Go 1.26 and 1.27, the two releases Go supports. The prebuilt binaries do not need Go at all.
Migrating
Run goroutinectx 0.10.0 over the repository.
| You see | Do this |
|---|---|
malformed goroutinectx directive |
Rewrite the comment as //goroutinectx:ignore or //goroutinectx:spawner: no space after // or after the colon, a line comment, a lowercase name |
A report under //goroutinectx:ignored or another lookalike |
Use the exact name, //goroutinectx:ignore |
A new report in a function passed to a helper marked //goroutinectx:spawnerX or similar |
Use the exact name, //goroutinectx:spawner |
| The build asks for a newer Go | Build with Go 1.26 or later, or install a prebuilt binary |
Full changelog: v0.9.3...v0.10.0