cmd/gomobile: better AndroidManifest errors
Before:
gomobile: EOF
After:
gomobile: error parsing /Users/crawshaw/src/golang.org/x/mobile/example/basic/AndroidManifest.xml: EOF
Change-Id: I5e890e3ede5eef04c0a9f26a894bf450da19b3d9
Reviewed-on: https://go-review.googlesource.com/13442
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/cmd/gomobile/build_androidapp.go b/cmd/gomobile/build_androidapp.go
index d9aa54c..9b0b689 100644
--- a/cmd/gomobile/build_androidapp.go
+++ b/cmd/gomobile/build_androidapp.go
@@ -23,7 +23,8 @@
func goAndroidBuild(pkg *build.Package) (map[string]bool, error) {
libName := path.Base(pkg.ImportPath)
- manifestData, err := ioutil.ReadFile(filepath.Join(pkg.Dir, "AndroidManifest.xml"))
+ manifestPath := filepath.Join(pkg.Dir, "AndroidManifest.xml")
+ manifestData, err := ioutil.ReadFile(manifestPath)
if err != nil {
if !os.IsNotExist(err) {
return nil, err
@@ -46,7 +47,7 @@
} else {
libName, err = manifestLibName(manifestData)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("error parsing %s: %v", manifestPath, err)
}
}
libPath := filepath.Join(tmpdir, "lib"+libName+".so")