我指的是這篇文章:云運行時的正常關閉該示例概述了如何在 Node.js 中執行此操作。在Golang中如何做到這一點?簡單地將其添加到方法中是否有任何問題?func init()func shutdownGracefully() { c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c // Do some cleanup stuff here... os.Exit(0) }()}
云運行時的正常關閉
慕無忌1623718
2022-08-24 09:36:29