github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/staticcheck/testdata/src/CheckUnbufferedSignalChan/CheckUnbufferedSignalChan.go (about) 1 package pkg 2 3 import ( 4 "os" 5 "os/signal" 6 "syscall" 7 ) 8 9 func fn(b bool) { 10 c0 := make(chan os.Signal) 11 signal.Notify(c0, os.Interrupt) // MATCH /the channel used with signal.Notify should be buffered/ 12 13 c1 := make(chan os.Signal, 1) 14 signal.Notify(c1, os.Interrupt, syscall.SIGHUP) 15 16 c2 := c0 17 if b { 18 c2 = c1 19 } 20 signal.Notify(c2, os.Interrupt, syscall.SIGHUP) 21 }