gogio: refuse compilation with additional arguments

Previously, it was possible to misuse gigio with arguments after the
package, such as `gogio -target android . -o foo.apk`. That cause an
undesired effect, since `-o` is silently ignore by gogio.

Now, any arguments after the package will trigger an error.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2022-05-07 16:14:54 +01:00
committed by Elias Naur
parent 6826ef0b64
commit 35e56c5af9
+3
View File
@@ -65,6 +65,9 @@ func flagValidate() error {
if pkgPathArg == "" {
return errors.New("specify a package")
}
if len(flag.Args()) > 1 {
return fmt.Errorf("build arguments must be specified before the package (%q)", pkgPathArg)
}
if *target == "" {
return errors.New("please specify -target")
}