Go Standard Library Cookbook
上QQ阅读APP看书,第一时间看更新

How it works…

The function Getpid from the os package returns the PID of a process. The sample code shows how to get more information on the process from the operating system utility ps.

It could be useful to print the PID at the start of the application, so at the time of the crash, the cause could also be investigated by the retrieved PID.