stack/stack.go
func (c *Call) updateLocations(goroot, localgoroot string, gopaths map[string]string) {
	if c.SrcPath != "" {
		// Always check GOROOT first, then GOPATH.
		if strings.HasPrefix(c.SrcPath, goroot) {
			// Replace remote GOROOT with local GOROOT.
			c.LocalSrcPath = filepath.Join(localgoroot, c.SrcPath[len(goroot):])
		} else {
			// Replace remote GOPATH with local GOPATH.
			c.LocalSrcPath = c.SrcPath
			// TODO(maruel): Sort for deterministic behavior?
			for prefix, dest := range gopaths {
				if strings.HasPrefix(c.SrcPath, prefix) {
					c.LocalSrcPath = filepath.Join(dest, c.SrcPath[len(prefix):])
					break
				}
			}
		}
	}
	// Consider _test/_testmain.go as stdlib since it's injected by "go test".
	c.IsStdlib = (goroot != "" && strings.HasPrefix(c.SrcPath, goroot)) || c.PkgSrc() == testMainSrc
}
func (c *Call) updateLocations(goroot, localgoroot string, gopaths map[string]string) {
	if c.SrcPath != "" {
		// Always check GOROOT first, then GOPATH.
		if strings.HasPrefix(c.SrcPath, goroot) {
			// Replace remote GOROOT with local GOROOT.
			c.LocalSrcPath = filepath.Join(localgoroot, c.SrcPath[len(goroot):])
		} else {
			// Replace remote GOPATH with local GOPATH.
			c.LocalSrcPath = c.SrcPath
			// TODO(maruel): Sort for deterministic behavior?
			for prefix, dest := range gopaths {
				if strings.HasPrefix(c.SrcPath, prefix) {
					c.LocalSrcPath = filepath.Join(dest, c.SrcPath[len(prefix):])
					break
				}
			}
		}
	}
	// Consider _test/_testmain.go as stdlib since it's injected by "go test".
	c.IsStdlib = (goroot != "" && strings.HasPrefix(c.SrcPath, goroot)) || c.PkgSrc() == testMainSrc
}
// updateLocations initializes LocalSrcPath and IsStdlib.