amseltools/vendor/github.com/matryer/is/is-before-1.7.go

24 lines
364 B
Go
Raw Permalink Normal View History

2023-03-29 15:26:21 +02:00
// +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
}
}