mirror of
https://github.com/golang/go
synced 2024-11-18 02:14:45 -07:00
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
This commit is contained in:
parent
47ee98253e
commit
85ae6a18b5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user