Skip to content

Instantly share code, notes, and snippets.

@lukehinds
Created January 25, 2017 19:43
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 lukehinds/9aadfffd3c763920b6cf73916f08157a to your computer and use it in GitHub Desktop.
Save lukehinds/9aadfffd3c763920b6cf73916f08157a to your computer and use it in GitHub Desktop.
Simple unix file wrapper in go
package main
import (
"os"
"os/exec"
)
func main() {
file := "/usr/bin/file"
arg := os.Args[1]
cmd := exec.Command(file, arg)
stdout, err := cmd.Output()
if err != nil {
println(err.Error())
return
}
print(string(stdout))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment