package main import ( "go.uber.org/automaxprocs/maxprocs" "log" "os" "os/signal" "runtime" "syscall" ) var build = "develop" func main() { // Set the correct number of threads for the service // based on what is available either by the machine or quoras. if _, err := maxprocs.Set(); err != nil { log.Println(err) return } g := runtime.GOMAXPROCS(0) log.Printf("starting service build[%s] CPU[%d]", build, g) defer log.Println("service ended") shutdown := make(chan os.Signal, 1) signal.Notify(shutdown, syscall.SIGINT, syscall.SIGTERM) <-shutdown log.Println("stopping service") }