1 // +build go1.2 2 3 package stack_test 4 5 import ( 6 "fmt" 7 8 "github.com/go-stack/stack" 9 ) 10 11 func Example_callFormat() { 12 logCaller("%+s") 13 logCaller("%v %[1]n()") 14 // Output: 15 // github.com/go-stack/stack/format_test.go 16 // format_test.go:13 Example_callFormat() 17 } 18 19 func logCaller(format string) { 20 fmt.Printf(format+"\n", stack.Caller(1)) 21 } 22