-
Notifications
You must be signed in to change notification settings - Fork 18k
go/parser: example for ParseFile fails on golang.org (playground) #19823
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
Comments
The example is being run in the (Go Playground)[https://play.golang.org/] Does the example work when you copy it to a new package and include a valid 'example_test.go' file? |
The example depends on its own file in the I guess a way to make it work in the playground would be for the example to first write a file to disk, or to use a buffer/string as the source. |
I'll write up a quick CL doing that. |
In (Inside the Go Playground)[https://blog.golang.org/playground] its mentioned that zip files may be uploaded for the purpose of examples. Perhaps uploading |
I think that's a bit overkill. If the purpose of the example was precisely to use a file via |
CL https://golang.org/cl/39236 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?n/a (error is on golang.org)
What operating system and processor architecture are you using (
go env
)?n/a
What did you do?
Visit https://golang.org/pkg/go/parser/#example_ParseFile (specifically, the example for ParseFile).
Click Run to run the example.
What did you expect to see?
Output of the program.
What did you see instead?
open example_test.go: No such file or directory
Program exited.
The text was updated successfully, but these errors were encountered: