File: format_test.go

package info (click to toggle)
golang-github-go-stack-stack 1.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, experimental, stretch, stretch-backports
  • size: 92 kB
  • ctags: 75
  • sloc: makefile: 6
file content (21 lines) | stat: -rw-r--r-- 340 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build go1.2

package stack_test

import (
	"fmt"

	"github.com/go-stack/stack"
)

func Example_callFormat() {
	logCaller("%+s")
	logCaller("%v   %[1]n()")
	// Output:
	// github.com/go-stack/stack/format_test.go
	// format_test.go:13   Example_callFormat()
}

func logCaller(format string) {
	fmt.Printf(format+"\n", stack.Caller(1))
}