Avatar ·

How to get process information by PID in Go

Hello everyone! I'm writing a small monitoring tool in Go that needs to track running processes in Linux. I need to get basic information by PID (process identifier): process name, status (running/sleeping/zombie), memory usage, uptime, and path to the executable file. I started simple: reading `/proc/[PID]/status` and `/proc/[PID]/cmdline`. But this feels hacky — I have to parse text files, and to get the full path to the binary I also need to read the symlink `/proc/[PID]/exe`. Moreover, I'm not sure this is a cross-platform solution — Windows and macOS don't have `/proc`. So far my code looks like this: ```go package main import ( "fmt" "io/ioutil" "os" "strconv" ) func getProcessName(pid int) (string, error) { data, err