You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
340 B

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