Tong Sun
2015-06-28 19:14:57 UTC
Hi,
Why the default print prints to Stderr?
I had always assumed that without specific instruction, print will print to
stdout, but astonished to find out that it (the built-in print) will print
to Stderr.
Why is that?
Thanks
-----------------------
package main
func main() {
print("To StdOut?\n")
}
-----------------------
$ go run StdOut.go | wc
To StdOut?
0 0 0
$ go run StdOut.go 2>&1 | wc
1 2 11
Why the default print prints to Stderr?
I had always assumed that without specific instruction, print will print to
stdout, but astonished to find out that it (the built-in print) will print
to Stderr.
Why is that?
Thanks
-----------------------
package main
func main() {
print("To StdOut?\n")
}
-----------------------
$ go run StdOut.go | wc
To StdOut?
0 0 0
$ go run StdOut.go 2>&1 | wc
1 2 11
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.