https://github.com/orijtech/sigchanyzer
signalchan is a static analyzer for Go to detect usage of unbuffer os.Signal channel, which can be at risk of missing the signal.
https://github.com/orijtech/sigchanyzer
Last synced: 4 months ago
JSON representation
signalchan is a static analyzer for Go to detect usage of unbuffer os.Signal channel, which can be at risk of missing the signal.
- Host: GitHub
- URL: https://github.com/orijtech/sigchanyzer
- Owner: orijtech
- License: apache-2.0
- Created: 2020-11-28T08:19:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-14T03:12:59.000Z (almost 5 years ago)
- Last Synced: 2026-01-15T07:04:11.262Z (5 months ago)
- Language: Go
- Size: 34.2 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sigchanyzer

Package sigchanyzer defines an [Analyzer](analyzer_link) that checks usage of unbuffered os.Signal channel, which can be at
risk of missing the signal.
## Installation
With Go modules:
```sh
go get github.com/orijtech/sigchanyzer/cmd/sigchanyzer
```
Without Go modules:
```sh
$ cd $GOPATH/src/github.com/orijtech/sigchanyzer
$ git checkout v0.0.2
$ go get
$ install ./cmd/sigchanyzer
```
## Usage
You can run `sigchanyzer` either on a Go package or Go files, the same way as
other Go tools work.
Example:
```sh
$ sigchanyzer github.com/orijtech/sigchanyzer/testdata/src/a
```
or:
```sh
$ sigchanyzer ./testdata/src/a/a.go
```
Sample output:
```text
/go/src/github.com/orijtech/sigchanyzer/testdata/a/a.go:16:7: unbuffered os.Signal channel
/go/src/github.com/orijtech/sigchanyzer/testdata/a/a.go:22:7: unbuffered os.Signal channel
```
## Development
Go 1.15+
### Running test
Add test case to `testdata/src/a` directory, then run:
```shell script
go test
```
## Contributing
All contributions are welcome, please report bug or open a pull request.
[analyzer_link]: https://pkg.go.dev/golang.org/x/tools/go/analysis#Analyzer