Created
February 17, 2014 03:31
-
-
Save jayschwa/9044258 to your computer and use it in GitHub Desktop.
`which` utility implemented in Go. Created for a Windows machine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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