Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / staticcheck / testdata / src / CheckUnbufferedSignalChan / CheckUnbufferedSignalChan.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckUnbufferedSignalChan/CheckUnbufferedSignalChan.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckUnbufferedSignalChan/CheckUnbufferedSignalChan.go
new file mode 100644 (file)
index 0000000..cb4d853
--- /dev/null
@@ -0,0 +1,21 @@
+package pkg
+
+import (
+       "os"
+       "os/signal"
+       "syscall"
+)
+
+func fn(b bool) {
+       c0 := make(chan os.Signal)
+       signal.Notify(c0, os.Interrupt) // want `the channel used with signal\.Notify should be buffered`
+
+       c1 := make(chan os.Signal, 1)
+       signal.Notify(c1, os.Interrupt, syscall.SIGHUP)
+
+       c2 := c0
+       if b {
+               c2 = c1
+       }
+       signal.Notify(c2, os.Interrupt, syscall.SIGHUP)
+}