Codebase list golang-github-matryer-is / d689ad47-508a-4609-84cc-d27d57a17bb7/upstream is-before-1.7.go
d689ad47-508a-4609-84cc-d27d57a17bb7/upstream

Tree @d689ad47-508a-4609-84cc-d27d57a17bb7/upstream (Download .tar.gz)

is-before-1.7.go @d689ad47-508a-4609-84cc-d27d57a17bb7/upstreamraw · history · blame

// +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
	}
}