Skip to content

Commit 85b9323

Browse files
mpywclaude
andcommitted
docs: add pkg.go.dev links for Go standard library and tools
- context.Context, context.Background, context.TODO - go/analysis, singlechecker, multichecker - errgroup.Group, errgroup.Group.Go - sync.WaitGroup, sync.WaitGroup.Go - go/types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 95204d5 commit 85b9323

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@ A Go linter that checks goroutine context propagation.
77

88
## Overview
99

10-
`goroutinectx` detects cases where a `context.Context` is available in function parameters but not properly passed to downstream calls that should receive it.
10+
`goroutinectx` detects cases where a [`context.Context`](https://pkg.go.dev/context#Context) is available in function parameters but not properly passed to downstream calls that should receive it.
1111

1212
## Installation
1313

14-
This analyzer is designed to be used as a library with `go/analysis`. To use it, import the analyzer in your own tool:
14+
This analyzer is designed to be used as a library with [`go/analysis`](https://pkg.go.dev/golang.org/x/tools/go/analysis). To use it, import the analyzer in your own tool:
1515

1616
```go
1717
import "github.com/mpyw/goroutinectx"
1818

1919
func main() {
20-
singlechecker.Main(goroutinectx.Analyzer)
20+
singlechecker.Main(goroutinectx.Analyzer) // singlechecker from go/analysis
2121
}
2222
```
2323

24-
Or use it with `multichecker` alongside other analyzers.
24+
See [`singlechecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/singlechecker) for details.
25+
26+
Or use it with [`multichecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/multichecker) alongside other analyzers.
2527

2628
## What It Checks
2729

@@ -66,9 +68,9 @@ func handler(ctx context.Context) {
6668

6769
This design ensures every goroutine explicitly acknowledges context propagation. If your goroutine doesn't need to use context directly but spawns nested goroutines that do, add `_ = ctx` to signal intentional propagation.
6870

69-
### errgroup.Group
71+
### [`errgroup.Group`](https://pkg.go.dev/golang.org/x/sync/errgroup#Group)
7072

71-
Detects `errgroup.Group.Go()` closures that don't use context:
73+
Detects [`errgroup.Group.Go`](https://pkg.go.dev/golang.org/x/sync/errgroup#Group.Go) closures that don't use context:
7274

7375
```go
7476
func handler(ctx context.Context) {
@@ -86,9 +88,9 @@ func handler(ctx context.Context) {
8688
}
8789
```
8890

89-
### sync.WaitGroup (Go 1.25+)
91+
### [`sync.WaitGroup`](https://pkg.go.dev/sync#WaitGroup) (Go 1.25+)
9092

91-
Detects `sync.WaitGroup.Go()` closures that don't use context:
93+
Detects [`sync.WaitGroup.Go`](https://pkg.go.dev/sync#WaitGroup.Go) closures that don't use context:
9294

9395
```go
9496
func handler(ctx context.Context) {
@@ -218,7 +220,7 @@ goroutinectx -goroutine-deriver='github.com/newrelic/go-agent/v3/newrelic.Transa
218220

219221
### `-context-carriers`
220222

221-
Treat additional types as context carriers (like `context.Context`). Useful for web frameworks that have their own context types.
223+
Treat additional types as context carriers (like [`context.Context`](https://pkg.go.dev/context#Context)). Useful for web frameworks that have their own context types.
222224

223225
```bash
224226
# Treat echo.Context as a context carrier
@@ -272,12 +274,12 @@ Also warns about unnecessary labels on functions that don't spawn and have no fu
272274
## Design Principles
273275

274276
1. **Zero false positives** - Prefer missing issues over false alarms
275-
2. **Type-safe analysis** - Uses `go/types` for accurate detection
277+
2. **Type-safe analysis** - Uses [`go/types`](https://pkg.go.dev/go/types) for accurate detection
276278
3. **Nested function support** - Correctly tracks context through closures
277279

278280
## Related Tools
279281

280-
- [contextcheck](https://github.com/kkHAIKE/contextcheck) - Detects `context.Background()`/`context.TODO()` usage and missing context parameters
282+
- [contextcheck](https://github.com/kkHAIKE/contextcheck) - Detects [`context.Background`](https://pkg.go.dev/context#Background)/[`context.TODO`](https://pkg.go.dev/context#TODO) usage and missing context parameters
281283

282284
`goroutinectx` is complementary to `contextcheck`:
283285
- `contextcheck` warns about creating new contexts when one should be propagated

0 commit comments

Comments
 (0)