Descriptioncmd/go: run main package when no files are listed
The go run command requires a list of Go source files that comprise
the main package, which are then compiled and run. A pattern such as
'*.go' can be used to satisfy the Go source file argument, but doing
so often leads to the following error:
go run: cannot run *_test.go files (*_test.go)
In many cases the above error is unavoidable because test files are
often found in same directory as the main package.
The go run command is inconsistent when compared to other commands.
For example, the go test command needs no arguments, compiles and
tests the package with source in the current directory by default.
Modify the go run command to make the Go source files argument optional.
With no arguments go run scans the current directory for package main.
If package main is located, compile and run it, if not go run exits
non-zero and prints the following error message:
go run: cannot locate main package
Fixes issue 5164.
Patch Set 1 #Patch Set 2 : diff -r 1849f83423ca https://code.google.com/p/go #Patch Set 3 : diff -r 1849f83423ca https://code.google.com/p/go #MessagesTotal messages: 4
|