Skip to content

Commit df18d38

Browse files
committed
Error on invalid gopherjs test -c, -o flag usage.
This prevents a situation with confusing results by following the same behavior as cmd/go command. Fixes gopherjs#764.
1 parent 9c69860 commit df18d38

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tool.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ func main() {
307307
patternContext := gbuild.NewBuildContext("", options.BuildTags)
308308
args = (&gotool.Context{BuildContext: *patternContext}).ImportPaths(args)
309309

310+
if *compileOnly && len(args) > 1 {
311+
return errors.New("cannot use -c flag with multiple packages")
312+
}
313+
if *outputFilename != "" && len(args) > 1 {
314+
return errors.New("cannot use -o flag with multiple packages")
315+
}
316+
310317
pkgs := make([]*gbuild.PackageData, len(args))
311318
for i, pkgPath := range args {
312319
var err error

0 commit comments

Comments
 (0)