Skip to content

signalchan is a static analyzer for Go to detect usage of unbuffer os.Signal channel, which can be at risk of missing the signal.

License

Notifications You must be signed in to change notification settings

orijtech/sigchanyzer

Repository files navigation

sigchanyzer

Build status

Package sigchanyzer defines an Analyzer that checks usage of unbuffered os.Signal channel, which can be at risk of missing the signal.

Installation

With Go modules:

go get github.com/orijtech/sigchanyzer/cmd/sigchanyzer

Without Go modules:

$ 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:

$ sigchanyzer github.com/orijtech/sigchanyzer/testdata/src/a

or:

$ sigchanyzer ./testdata/src/a/a.go

Sample output:

/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:

go test

Contributing

All contributions are welcome, please report bug or open a pull request.

About

signalchan is a static analyzer for Go to detect usage of unbuffer os.Signal channel, which can be at risk of missing the signal.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages