Closed
Description
by izmalych:
What steps will reproduce the problem? main.go: package main import ( "fmt"; "runtime"; ) func main() { log("line # 9") fmt.Println("line # 10") log("line # 11") fmt.Println("line # 12") } func log(message string){ _, file, line, ok := runtime.Caller(1) if !ok { fmt.Println("some error"); return } fmt.Printf("%s:%d %s\n", file, line, message) } What is the expected output? ./main.out /home/alexni/workspace/go/test/main.go:9 line # 9 line # 10 /home/alexni/workspace/go/test/main.go:11 line # 11 line # 12 What do you see instead? ./main.out /home/alexni/workspace/go/test/main.go:10 line # 9 line # 10 ^^^^ /home/alexni/workspace/go/test/main.go:12 line # 11 line # 12 ^^^^ What is your $GOOS? $GOARCH? GOARCH=amd64 GOOS=linux Which revision are you using? (hg identify) 2dc7f4773836 tip 6g version 5040