File: is-before-1.7.go

package info (click to toggle)
golang-github-matryer-is 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 204 kB
  • sloc: makefile: 2
file content (23 lines) | stat: -rw-r--r-- 364 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
22
23
// +build !go1.7

package is

import (
	"regexp"
	"runtime"
)

var reIsSourceFile = regexp.MustCompile("is(-before-1.7)?\\.go$")

func (is *I) callerinfo() (path string, line int, ok bool) {
	for i := 0; ; i++ {
		_, path, line, ok = runtime.Caller(i)
		if !ok {
			return
		}
		if reIsSourceFile.MatchString(path) {
			continue
		}
		return path, line, true
	}
}