github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/CheckUntrappableSignal.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"os/signal"
     6  	"syscall"
     7  )
     8  
     9  func fn() {
    10  	c := make(chan os.Signal, 1)
    11  	signal.Notify(c, os.Interrupt)
    12  	signal.Ignore(os.Signal(syscall.SIGKILL)) // MATCH /cannot be trapped/
    13  	signal.Ignore(os.Kill)                    // MATCH /cannot be trapped/
    14  	signal.Notify(c, os.Kill)                 // MATCH /cannot be trapped/
    15  	signal.Reset(os.Kill)                     // MATCH /cannot be trapped/
    16  	signal.Ignore(syscall.SIGKILL)            // MATCH /cannot be trapped/
    17  	signal.Notify(c, syscall.SIGKILL)         // MATCH /cannot be trapped/
    18  	signal.Reset(syscall.SIGKILL)             // MATCH /cannot be trapped/
    19  	signal.Ignore(syscall.SIGSTOP)            // MATCH /cannot be trapped/
    20  	signal.Notify(c, syscall.SIGSTOP)         // MATCH /cannot be trapped/
    21  	signal.Reset(syscall.SIGSTOP)             // MATCH /cannot be trapped/
    22  }