diff --git a/src/cmd/go/run.go b/src/cmd/go/run.go index d189d70aac..94cd592969 100644 --- a/src/cmd/go/run.go +++ b/src/cmd/go/run.go @@ -42,12 +42,15 @@ func runRun(cmd *Command, args []string) { i++ } files, cmdArgs := args[:i], args[i:] + if len(files) == 0 { + fatalf("go run: no go files listed") + } p := goFilesPackage(files) if p.Error != nil { fatalf("%s", p.Error) } if p.Name != "main" { - fatalf("cannot run non-main package") + fatalf("go run: cannot run non-main package") } p.target = "" // must build - not up to date a1 := b.action(modeBuild, modeBuild, p)