You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: README.md
+27-3Lines changed: 27 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,22 +9,46 @@ A Go linter that checks goroutine context propagation.
9
9
10
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.
11
11
12
-
## Installation
12
+
## Installation & Usage
13
13
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
15
35
16
36
```go
17
37
import"github.com/mpyw/goroutinectx"
18
38
19
39
funcmain() {
20
-
singlechecker.Main(goroutinectx.Analyzer)// singlechecker from go/analysis
40
+
singlechecker.Main(goroutinectx.Analyzer)
21
41
}
22
42
```
23
43
24
44
See [`singlechecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/singlechecker) for details.
25
45
26
46
Or use it with [`multichecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/multichecker) alongside other analyzers.
27
47
48
+
### golangci-lint
49
+
50
+
Not currently integrated with golangci-lint. PRs welcome if someone wants to add it, but not actively pursuing integration.
0 commit comments