Exemplo n.º 1
0
Arquivo: bin.go Projeto: rjeczalik/bin
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()
}
Exemplo n.º 2
0
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)
}