Skip to content
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

x/pkgsite: ioutil/Readfile does not run correctly in pkg.go.dev example. #49036

Open
TimothyStiles opened this issue Oct 18, 2021 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@TimothyStiles
Copy link

TimothyStiles commented Oct 18, 2021

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

Screen Shot 2021-10-18 at 4 48 05 AM

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:
crop-output

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.

@gopherbot gopherbot added this to the Unreleased milestone Oct 18, 2021
@AlexanderYastrebov
Copy link
Contributor

Similar to #32916 and related to #19825

@jamalc jamalc added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 10, 2021
@jamalc jamalc modified the milestones: Unreleased, pkgsite/unplanned Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants