github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa1016/testdata/src/example.com/CheckUntrappableSignal/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)) //@ diag(`cannot be trapped`)
    13  	signal.Ignore(os.Kill)                    //@ diag(`cannot be trapped`)
    14  	signal.Notify(c, os.Kill)                 //@ diag(`cannot be trapped`)
    15  	signal.Reset(os.Kill)                     //@ diag(`cannot be trapped`)
    16  	signal.Ignore(syscall.SIGKILL)            //@ diag(`cannot be trapped`)
    17  	signal.Notify(c, syscall.SIGKILL)         //@ diag(`cannot be trapped`)
    18  	signal.Reset(syscall.SIGKILL)             //@ diag(`cannot be trapped`)
    19  }