Find executable (which where)



examples/find-executable/find_executable.go
package main

import (
    "fmt"
    "os"
    "os/exec"
)

func main() {
    path, err := exec.LookPath("python")
    if err != nil {
        fmt.Println("Could not find path")
        os.Exit(1)
    }
    fmt.Printf("%v %T\n", path, path)
}

examples/find-executable/find_executable.out
/home/gabor/venv3/bin/python string