I want execute the dexdump in Android SDK platform-tools on Go language.
I already set the PATH variable. (I'm use Ubuntu 12.04)
Here is my code:
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
)
func main() {
path, err := exec.LookPath("dexdump")
if err != nil {
log.Fatal(err)
}
fmt.Println(path)
cmd := exec.Command(path)
var out bytes.Buffer
cmd.Stdout = &out
err2 := cmd.Run()
if err2 != nil {
log.Fatal(err2)
}
fmt.Printf("%q
", out.String())
}
Result: /home/gunwoo/android-sdk-linux/platform-tools/dexdump
2012/10/15 16:44:39 exit status 2
exit status 1
why go doesn't find the path?