aboutsummaryrefslogtreecommitdiff
path: root/go/analysis/passes/sigchanyzer/sigchanyzer.go
AgeCommit message (Collapse)Author
2022-04-04all: fix spellingDan Kortschak
Change-Id: I13cf73d7e043dda1a06c28bb09e413a76a68df1f Reviewed-on: https://go-review.googlesource.com/c/tools/+/391934 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-05-12go/analysis/passes/sigchanyzer: copy to avoid modifying the ASTFernandez Ludovic
The sigchanyzer pass suggests fixes, but it does that by altering the channel declaration argument. That causes the buildssa.Analyzer fail to fail, along with crashing other passes that depend on it. To fix this, we make a copy of the channel's declaration arguments, and modify the copy instead. Fixes golang/go#46129 Change-Id: I807d36abd49cd3ccc2cc9f907aa98349b2e3231f Reviewed-on: https://go-review.googlesource.com/c/tools/+/319211 Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-04-22passes/sigchanyzer: allow valid inlined unbuffered signal channelAGMETEOR
Permit signal.Notify(make(chan os.Signal)) which is valid code, given that the channel isn't read elsewhere, the fact that signals can be lost is unimportant. Updates golang/go#45043 Change-Id: Ie984dfeedbb4e1e33a29391c3abb1fc83299fed3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/311729 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-02-16go/analysis/passes: add sigchanyzer AnalyzerCuong Manh Le
This change brings in a static analyzer that was created by Orijtech, Inc. to detect the use of unbuffered channels with signal.Notify, which is a bug that's documented but not enforced. We've found it even in official examples and in the main Go repository as per https://go-review.googlesource.com/c/go/+/274332. We've found that this bug is very common in lots of Go code, hence the reason why we are directly donating it, so that all Go developers running go test, using gopls can use it. Updates golang/go#9399 Change-Id: Ief6d7238dc80bc9fd5f11a585e41387704457276 Reviewed-on: https://go-review.googlesource.com/c/tools/+/274352 gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Rebecca Stambler <rstambler@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>