How can I get the list of currently running processes in Go?
The OS package provides some functions: http://golang.org/pkg/os/
but doesn’t give anything to see the list of running processes.
There is no such function in the standard library and most likely never will be.
In most cases, the list of processes isn’t required by programs. Go programs usually want to wait for a single or a smaller number of processes, not for all processes. PIDs of processes are usually obtained by other means than searching the list of all processes.
If you are on Linux, the list of processes can be obtained by reading contents of
/proc directory. See question Linux API to list running processes?
Answered By – user811773
Answer Checked By – Marilyn (GoLangFix Volunteer)