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/playground: stdout and stderr not interleaved with defer #10279
Comments
Are you sure this isn't just the result of mixing stderr and stdout differently? Try it using only one print function. |
Yes, indeed. I'm closing this now. Please mark as “invalid.” |
It's still weird that I cannot reproduce this behaviour without deference. Go seems to obey the order in which I output things in other cases. |
Reopening with new title. I think the playground's hooks for intercepting os.Stdout and os.Stderr don't work for the builtin These work, using only one style of printing: http://play.golang.org/p/c0XFpaPnh8 -- with println (stderr) This is wrong, or at least confusing: http://play.golang.org/p/L0ys_wO462 /cc @adg (who's on vacation for ~5 more weeks) |
This runs correctly on playground: http://play.golang.org/p/L0ys_wO462
Same is valid for the program on the top. /CC @bradfitz |
After running couple of more attempts to break on playground, I can say that this works as designed. We can close it. |
Closing as and the mixed version http://play.golang.org/p/L0ys_wO462 all have the same output of
|
Thanks @andybons ! |
Consider the following program:
On my machine (amd64 Linux), this program prints as expected:
whereas on Playground, it prints the following incorrect output:
I have no idea what causes this effect but it seems that the first deferred function call is executed before the final
fmt.Println
call inmain
.The text was updated successfully, but these errors were encountered: