Buffering 'go test' output

302 views
Skip to first unread message

Gustavo Niemeyer

unread,
Jan 31, 2012, 7:07:49 AM1/31/12
to golang-dev
Hi there,

What is the rationale for "go test" to be buffering the output now?
In many circumstances, it's useful to see debugging output from a test
while it is still running.

If we can't bring back the non-buffered running, can we at least have
a flag that disables the buffering?

--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/plus
http://niemeyer.net/twitter
http://niemeyer.net/blog

-- I'm not absolutely sure of anything.

David Symonds

unread,
Jan 31, 2012, 7:18:37 AM1/31/12
to Gustavo Niemeyer, golang-dev
On Tue, Jan 31, 2012 at 11:07 PM, Gustavo Niemeyer <gus...@niemeyer.net> wrote:

> What is the rationale for "go test" to be buffering the output now?
> In many circumstances, it's useful to see debugging output from a test
> while it is still running.

I believe it's so that tests can run in parallel without their output
getting mixed up.


Dave.

Dmitry Vyukov

unread,
Jan 31, 2012, 7:27:25 AM1/31/12
to David Symonds, Gustavo Niemeyer, golang-dev
On Tue, Jan 31, 2012 at 4:18 PM, David Symonds <dsym...@golang.org> wrote:
On Tue, Jan 31, 2012 at 11:07 PM, Gustavo Niemeyer <gus...@niemeyer.net> wrote:

> What is the rationale for "go test" to be buffering the output now?
> In many circumstances, it's useful to see debugging output from a test
> while it is still running.

I also miss the real time output.
 
I believe it's so that tests can run in parallel without their output
getting mixed up.

I think we can have both.
Current test -> stdout
Non-current tests -> buffer
When the test becomes current it's buffer is copied to stdout, further output goes directly to stdout

For 1-package tests there will be no different from previous gotest real time output.

Russ Cox

unread,
Jan 31, 2012, 10:29:14 AM1/31/12
to Gustavo Niemeyer, golang-dev
> What is the rationale for "go test" to be buffering the output now?
> In many circumstances, it's useful to see debugging output from a test
> while it is still running.
>
> If we can't bring back the non-buffered running, can we at least have
> a flag that disables the buffering?

My plan is that if you are running a single test it won't buffer,
but I am not there yet.

gabriel...@gmail.com

unread,
Jul 15, 2016, 1:31:06 PM7/15/16
to golang-dev
Sorry to bump this - I just wanted to explicitly note that this feature _was_ implemented shortly after the last comment in this thread. Thanks Russ!

(I'm a newb that had gotten in the habit of using go test -v -run "pattern" ./... in my small multi-package project, so I was running into unwanted buffering - it wasn't clear to me from this thread or the GitHub issue that the feature had long been implemented - it looked at first glance that it had been closed as stale. Just trying to help the next person in my shoes as this mailing list is well-indexed by search engines)

Dave Cheney

unread,
Jul 15, 2016, 6:16:46 PM7/15/16
to gabriel...@gmail.com, golang-dev

Please don't comment on a four year old thread.

Please start a new thread which explains the problem you are having.

Thanks

Dave


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages