The playground docs say:
If the program contains tests or examples and no main function, the service runs the tests.
This example contains tests and no main function, but it doesn't work. Looks like that's because it also contains other files.
https://play.golang.org/p/eYjtKS7J25y
I'd expect the example to run TestFoo
as a test.
Comment From: bcmills
For an even smaller repro, compare:
https://play.golang.org/p/t-tmCBPADwt compiles and runs.
https://play.golang.org/p/PkTK3_aY7L8, which adds only a go.mod file, fails:
# example.com
runtime.main_main·f: function main is undeclared in the main package
Go build failed.
Comment From: bcmills
CC @ysmolsky @andybons @dmitshur
Comment From: bcmills
This support would be really useful for go test
reports like the one in #32379.
Comment From: rogpeppe
Ha, I just went to report this problem and found that I reported it over 2 years ago. :rofl: Surely it's not that hard to fix?
Comment From: nikola-jokic
Can I take this one? :relaxed:
Comment From: gopherbot
Change https://go.dev/cl/462835 mentions this issue: x/playground: support multifile code with tests