x/pkgsite: ioutil/Readfile does not run correctly in pkg.go.dev example. #49036
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
pkgsite
Milestone
Hello!
I think I've found a bug where example tests won't run properly in
go.pkg.dev
if they use any sort of file io.What is the URL of the page with the issue?
https://pkg.go.dev/io/ioutil#example-ReadFile
What is your user agent?
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Firefox/92.0
Screenshot
What did you do?
I tried running this example from ioutil's docs. It returns the error after hitting the run button but renders the correct output by default.
What did you expect to see?
I expected to see the file's contents as printed output after hitting the run button
What did you see instead?
This:

It looks like the example's isolated environment doesn't have the file used in this test example. Which means that tests will run and pass locally and on CI/CD but not on
pkg.go.dev
itself. Is there any way to include the file in this rendered example's environment?Thanks!
Tim
P.S
Looks like this is also the case for os.ReadFile.
The text was updated successfully, but these errors were encountered: