On 09/28/2017 07:29 PM, gocss wrote:
> first the code follow by output from 'go test -v'
> 

Take a look at src/testing/example.go around line 15.

The testing code temporarily re-assigns os.Stdout for the duration of
the Example.  It sets it to one of the end of a pipe that it uses to
capture the output of anything that writes to os.Stdout.

Since you are logging to a copy of os.Stdout, your first test wirtes to
a copy of os.Stdout and thus escapes/avoids having it's output captured
by go test.

I think the short answer is: don't do that?

-ayan

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

Reply via email to