普通网友 2014-11-12 18:18
浏览 17
已采纳

执行os.Exit(1)时如何禁用“退出状态1”

In one of my go projects, I run os.Exit(1) and it prints out exit status 1. How can I disable this message to be printed?

  • 写回答

1条回答 默认 最新

  • douweihui0178 2014-11-12 19:32
    关注

    To disable the message, don't use go run.

    go run is a tool to conveniently compile one or more go files into a temporary location, execute the binary, and clean up. Your executable is run in a sub-process, and the go tool is reporting the exit status for you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?