func importpkg(path string) (string, error) { ex, err := which.NewExec(path) if err != nil { return "", err } if ex.Type.GOOS != runtime.GOOS || ex.Type.GOARCH != runtime.GOARCH { return "", errors.New("bin: cross-compiling is not supported yet") } return ex.Import() }
func main() { if len(os.Args) != 2 { die(usage) } if ishelp(os.Args[1]) { fmt.Println(usage) return } path, err := exec.LookPath(os.Args[1]) if err != nil { die(err) } ex, err := which.NewExec(path) if err != nil { die(err) } fmt.Println(ex.Type) }