New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: fix error for go run of files in different directories #9853
Comments
Try making a package of I don't think this will be further extended... |
That's certainly an option. In my case it's still not much more than a dirty hack that grew and is now spread across multiple files. To clean up I started to put things in folders and suddenly If this is not to be supported then at least expectations and error messages should be adjusted. Either it should be done right or made clear it's no option. I don't really see a middle ground here. |
If you try this way, you will see why it's unsupported:
go run folder/*.go main.go
The go command requires each package to be in a single directory, and this
requirement applies to the main package too.
We should fix the error for go run main.go folder/*.go to be the same, but
we shouldn't make it support this usage.
|
Well, then I am all for fixing the error message. And maybe be a little more explicit in the docs. |
CL https://golang.org/cl/12149 mentions this issue. |
Based on
I would have thought that it would be OK to run
go
files likebut for reasons I don't understand it tries to find the file
folder/main.go
instead (and obviously fails). All files are in themain
package.It would be nice to allow arbitrary paths to the
go
files.If that's out of question at least the docs and error message should be improved.
http://golang.org/doc/code.html
https://golang.org/cmd/go/#hdr-Compile_and_run_Go_program
The text was updated successfully, but these errors were encountered: