package main
import (
"fmt"
"os"
"os/exec"
"strconv"
)
func main() {
pid := os.Getpid()
fmt.Printf("Process PID: %d \n\n", pid)
prc := exec.Command("ps", "-p", strconv.Itoa(pid), "-v")
out, err := prc.Output()
if err != nil {
panic(err)
}
fmt.Println(string(out))
}
/*
./go_web
Process PID: 4942
PID STAT TIME SL RE PAGEIN VSZ RSS LIM TSIZ %CPU %MEM COMMAND
4942 S 0:00.01 0 0 0 558433672 1452 - 0 0.0 0.0 /private/var/folders/tw/g0l_2m8s7y5690qqjdsvrzd00000gn/T/___go_build_b_go
*/