📌  相关文章
📜  通过中断停止 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:44:59.017000             🧑  作者: Mango

代码示例1
package main

import (
    "log"
    "os"
    "os/signal"
    "syscall"
)

func main() {
    done := make(chan os.Signal, 1)
    signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
 
    <-done
    log.Print("Server Stopped")
}