Commit 85ae6a18 authored by Russ Cox's avatar Russ Cox

cmd/go: fix run errors

$ go run
go run: no go files listed
$ go run ../../pkg/math/bits.go
go run: cannot run non-main package
$

Fixes #3168.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5755064
parent 47ee9825
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment