refactor and to go mod

This commit is contained in:
YouROK
2021-02-18 16:56:55 +03:00
parent 0e49a98626
commit 94f212fa75
50 changed files with 13 additions and 29 deletions

View File

@@ -0,0 +1,31 @@
// +build !windows
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func Preconfig(dkill bool) {
if dkill {
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGSTOP,
syscall.SIGPIPE,
syscall.SIGTERM,
syscall.SIGQUIT)
go func() {
for s := range sigc {
if dkill {
fmt.Println("Signal catched:", s)
fmt.Println("For stop server, close in api")
}
}
}()
}
}