MCPcopy Index your code
hub / github.com/maruel/panicparse / init

Method init

stack/stack.go:383–399  ·  view source on GitHub ↗

Init initializes RemoteSrcPath, SrcName, DirName and Line. For test main, it initializes Location only with Stdlib. It does its best educated guess for ImportPath.

(srcPath string, line int)

Source from the content-addressed store, hash-verified

381//
382// It does its best educated guess for ImportPath.
383func (c *Call) init(srcPath string, line int) {
384 c.Line = line
385 if srcPath != "" {
386 c.RemoteSrcPath = srcPath
387 if i := strings.LastIndexByte(c.RemoteSrcPath, '/'); i != -1 {
388 c.SrcName = c.RemoteSrcPath[i+1:]
389 if i = strings.LastIndexByte(c.RemoteSrcPath[:i], '/'); i != -1 {
390 c.DirSrc = c.RemoteSrcPath[i+1:]
391 }
392 }
393 if c.DirSrc == testMainSrc {
394 // Consider _test/_testmain.go as stdlib since it's injected by "go test".
395 c.Location = Stdlib
396 }
397 }
398 c.ImportPath = c.Func.ImportPath
399}
400
401const testMainSrc = "_test" + string(os.PathSeparator) + "_testmain.go"
402

Callers 3

newCallFunction · 0.95
scanMethod · 0.80
parseFileFunction · 0.80

Calls

no outgoing calls

Tested by 1

newCallFunction · 0.76