cmd/gio: use the import path as basis for the output file

Before this change `go list <pkg>` was used to sanitize the import
path of the package argument. That doesn't work well for building
Go source files directly:

gio -target android helloworld.go

where `go list helloworld.go` simply returns "command-line-arguments".

A better way is to leave the package path alone, and compute the
output file separately from the import path, as reported by
`go list -f {{.ImportPath}} <pkg>`.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-13 20:19:25 +02:00
parent 41990e3275
commit cde040369c
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ import (
func buildJS(bi *buildInfo) error {
out := *destPath
if out == "" {
out = filepath.Base(bi.pkg)
out = bi.name
}
if err := os.MkdirAll(out, 0700); err != nil {
return err