-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: incorrect example output #58476
Comments
I did some investigation. For the mentioned example, this is the response from /play/compile, which is correct: {
"Errors": "",
"Events": [
{
"Message": "calculating the answer\n",
"Kind": "stdout",
"Delay": 0
},
{
"Message": "calculating the answer\n",
"Kind": "stdout",
"Delay": 692931475
},
{
"Message": "calculating the answer\nthe answer is 42\nsuccess\n",
"Kind": "stdout",
"Delay": 600101775
}
],
"Status": 0,
"IsTest": false,
"TestsFailed": 0
} The problem is here: for (const e of Events || []) {
this.setOutputText(e.Message); // should *append* e.Message
await new Promise(resolve => setTimeout(resolve, e.Delay / 1000000));
} Because of the bug above, when there are multiple Events, only the last one is displayed. |
soroushj
added a commit
to soroushj/pkgsite
that referenced
this issue
Feb 11, 2023
Display outputs with multiple events correctly. Fixes golang/go#58476
Change https://go.dev/cl/467575 mentions this issue: |
soroushj
added a commit
to soroushj/pkgsite
that referenced
this issue
Feb 22, 2023
A response from the playground server contains a list of events. Each event contains a message. The final playground output should be the concatenation of all event messages. The existing playground implementation sets the output text to each event message, so the final output would be only the last event message. Fix this by appending event messages to the output text. The existing tests do not test the playground with a mock response containing multiple events. Change a mock response to contain two events. All changes are automatic except for playground.ts and playground.test.ts. Fixes golang/go#58476
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What is the URL of the page with the issue?
https://pkg.go.dev/github.com/soroushj/gosyphus@v1.0.0#example-package
What is your user agent?
Chrome 110 on Linux (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36)
Screenshot
What did you do?
Ran the first package example.
What did you expect to see?
This output:
What did you see instead?
This output:
The text was updated successfully, but these errors were encountered: