I execute this code snippet in goland IDE but found the output order is NOTthe same as what I expected:
package main
import (
"fmt"
"errors"
)
func main() {
println("===========================")
println("---------------------------")
r,_:= div(6,3)
fmt.Println(r)
}
func div(x, y int) (int, error) {
defer println("dispose...")
if y == 0 {
return 0, errors.New("division by zero")
}
return x / y, nil
}
output:
- why the out order is differ from code order
- why the output in different color(white & red), I use goland IDE by jetbrain
I could not reproduce in https://play.golang.org/p/2T5LOt7FRDn My Local env: windows 10 + go1.10.3 windows/amd64 + GoLand 2018.1.4