1// +build go1.2 2 3package stack_test 4 5import ( 6 "fmt" 7 8 "github.com/go-stack/stack" 9) 10 11func 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 19func logCaller(format string) { 20 fmt.Printf(format+"\n", stack.Caller(1)) 21} 22