Skip to content

Commit bd183ef

Browse files
mpywclaude
andcommitted
docs: add Installation & Usage section with go vet, go tool examples
- go vet -vettool (Recommended) - go tool (Go 1.24+) - As a Library (singlechecker/multichecker) - golangci-lint note (PRs welcome but not actively pursuing) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2d10189 commit bd183ef

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,46 @@ A Go linter that checks goroutine context propagation.
99

1010
`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

12-
## Installation
12+
## Installation & Usage
1313

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:
14+
### Using [`go vet`](https://pkg.go.dev/cmd/go#hdr-Report_likely_mistakes_in_packages) (Recommended)
15+
16+
```bash
17+
# Install the analyzer
18+
go install github.com/mpyw/goroutinectx/cmd/goroutinectx@latest
19+
20+
# Run with go vet
21+
go vet -vettool=$(which goroutinectx) ./...
22+
```
23+
24+
### Using [`go tool`](https://pkg.go.dev/cmd/go#hdr-Run_specified_go_tool) (Go 1.24+)
25+
26+
```bash
27+
# Add to go.mod as a tool dependency
28+
go get -tool github.com/mpyw/goroutinectx/cmd/goroutinectx@latest
29+
30+
# Run via go tool
31+
go tool goroutinectx ./...
32+
```
33+
34+
### As a Library
1535

1636
```go
1737
import "github.com/mpyw/goroutinectx"
1838

1939
func main() {
20-
singlechecker.Main(goroutinectx.Analyzer) // singlechecker from go/analysis
40+
singlechecker.Main(goroutinectx.Analyzer)
2141
}
2242
```
2343

2444
See [`singlechecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/singlechecker) for details.
2545

2646
Or use it with [`multichecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/multichecker) alongside other analyzers.
2747

48+
### golangci-lint
49+
50+
Not currently integrated with golangci-lint. PRs welcome if someone wants to add it, but not actively pursuing integration.
51+
2852
## What It Checks
2953

3054
### goroutines

0 commit comments

Comments
 (0)