refactor command package to remove globals and add dependency injection

This commit is contained in:
Christopher Angelo Phillips
2022-04-26 18:23:03 +00:00
committed by GitHub
parent 7304bbf8ee
commit 6029dd7c2e
44 changed files with 1781 additions and 1870 deletions
+20
View File
@@ -0,0 +1,20 @@
package eventloop
import (
"os"
"os/signal"
"syscall"
)
func SetupSignals() <-chan os.Signal {
c := make(chan os.Signal, 1) // Note: A buffered channel is recommended for this; see https://golang.org/pkg/os/signal/#Notify
interruptions := []os.Signal{
syscall.SIGINT,
syscall.SIGTERM,
}
signal.Notify(c, interruptions...)
return c
}