Skip to content

Instantly share code, notes, and snippets.

@jayschwa
Created February 17, 2014 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jayschwa/9044258 to your computer and use it in GitHub Desktop.
Save jayschwa/9044258 to your computer and use it in GitHub Desktop.
`which` utility implemented in Go. Created for a Windows machine.
package main
import (
"fmt"
"os"
"os/exec"
)
func main() {
for _, cmd := range os.Args[1:] {
path, err := exec.LookPath(cmd)
if err == nil {
fmt.Println(path)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment