Here is my code: package main
import "log"
import "fmt"
func main() {
var a string = "initail"
log.Println(a)
var b, c int = 1, 2
fmt.Println(b, c)
}
The output is:
1 2
2016/12/30 14:22:58 initail
So i don't understand why the output's order? why log.Println
is slower than fmt.Println
?
Only difference between those in terms of its printing behaviour is
log.Println
writes to Stderr
fmt.Println
writes to Stdout
Both are not buffered. So the fact that StdOut
came before StdError
is specific to your terminal or environment.
Here is a play link https://play.golang.org/p/0cukg_a9GR