.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / staticcheck / testdata / src / CheckUntrappableSignal / CheckUntrappableSignal.go.golden
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/staticcheck/testdata/src/CheckUntrappableSignal/CheckUntrappableSignal.go.golden b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/staticcheck/testdata/src/CheckUntrappableSignal/CheckUntrappableSignal.go.golden
new file mode 100644 (file)
index 0000000..aff90a1
--- /dev/null
@@ -0,0 +1,83 @@
+-- remove syscall.SIGKILL from list of arguments --
+package main
+
+import (
+       "os"
+       "os/signal"
+       "syscall"
+)
+
+func fn() {
+       c := make(chan os.Signal, 1)
+       signal.Notify(c, os.Interrupt)
+       signal.Ignore()           // want `cannot be trapped`
+       signal.Ignore(os.Kill)    // want `cannot be trapped`
+       signal.Notify(c, os.Kill) // want `cannot be trapped`
+       signal.Reset(os.Kill)     // want `cannot be trapped`
+       signal.Ignore()           // want `cannot be trapped`
+       signal.Notify(c)          // want `cannot be trapped`
+       signal.Reset()            // want `cannot be trapped`
+}
+
+-- remove os.Kill from list of arguments --
+package main
+
+import (
+       "os"
+       "os/signal"
+       "syscall"
+)
+
+func fn() {
+       c := make(chan os.Signal, 1)
+       signal.Notify(c, os.Interrupt)
+       signal.Ignore(os.Signal(syscall.SIGKILL)) // want `cannot be trapped`
+       signal.Ignore()                           // want `cannot be trapped`
+       signal.Notify(c)                          // want `cannot be trapped`
+       signal.Reset()                            // want `cannot be trapped`
+       signal.Ignore(syscall.SIGKILL)            // want `cannot be trapped`
+       signal.Notify(c, syscall.SIGKILL)         // want `cannot be trapped`
+       signal.Reset(syscall.SIGKILL)             // want `cannot be trapped`
+}
+
+-- use syscall.SIGTERM instead of syscall.SIGKILL --
+package main
+
+import (
+       "os"
+       "os/signal"
+       "syscall"
+)
+
+func fn() {
+       c := make(chan os.Signal, 1)
+       signal.Notify(c, os.Interrupt)
+       signal.Ignore(syscall.SIGTERM)    // want `cannot be trapped`
+       signal.Ignore(os.Kill)            // want `cannot be trapped`
+       signal.Notify(c, os.Kill)         // want `cannot be trapped`
+       signal.Reset(os.Kill)             // want `cannot be trapped`
+       signal.Ignore(syscall.SIGTERM)    // want `cannot be trapped`
+       signal.Notify(c, syscall.SIGTERM) // want `cannot be trapped`
+       signal.Reset(syscall.SIGTERM)     // want `cannot be trapped`
+}
+
+-- use syscall.SIGTERM instead of os.Kill --
+package main
+
+import (
+       "os"
+       "os/signal"
+       "syscall"
+)
+
+func fn() {
+       c := make(chan os.Signal, 1)
+       signal.Notify(c, os.Interrupt)
+       signal.Ignore(os.Signal(syscall.SIGKILL)) // want `cannot be trapped`
+       signal.Ignore(syscall.SIGTERM)            // want `cannot be trapped`
+       signal.Notify(c, syscall.SIGTERM)         // want `cannot be trapped`
+       signal.Reset(syscall.SIGTERM)             // want `cannot be trapped`
+       signal.Ignore(syscall.SIGKILL)            // want `cannot be trapped`
+       signal.Notify(c, syscall.SIGKILL)         // want `cannot be trapped`
+       signal.Reset(syscall.SIGKILL)             // want `cannot be trapped`
+}