(f string, a stack.Args, s string, l int)
| 181 | } |
| 182 | |
| 183 | func newCallLocal(f string, a stack.Args, s string, l int) stack.Call { |
| 184 | c := stack.Call{Func: newFunc(f), Args: a, RemoteSrcPath: s, Line: l} |
| 185 | // Do the equivalent of Call.init(). |
| 186 | c.SrcName = filepath.Base(c.RemoteSrcPath) |
| 187 | c.DirSrc = path.Join(filepath.Base(c.RemoteSrcPath[:len(c.RemoteSrcPath)-len(c.SrcName)-1]), c.SrcName) |
| 188 | const goroot = "/goroot/src/" |
| 189 | const gopath = "/home/user/go/src/" |
| 190 | const gopathmod = "/home/user/go/pkg/mod/" |
| 191 | // Do the equivalent of Call.updateLocations(). |
| 192 | if strings.HasPrefix(s, goroot) { |
| 193 | c.LocalSrcPath = s |
| 194 | c.RelSrcPath = s[len(goroot):] |
| 195 | c.Location = stack.Stdlib |
| 196 | } else if strings.HasPrefix(s, gopath) { |
| 197 | c.LocalSrcPath = s |
| 198 | c.RelSrcPath = s[len(gopath):] |
| 199 | c.Location = stack.GOPATH |
| 200 | } else if strings.HasPrefix(s, gopathmod) { |
| 201 | c.LocalSrcPath = s |
| 202 | c.RelSrcPath = s[len(gopathmod):] |
| 203 | c.Location = stack.GoPkg |
| 204 | } |
| 205 | return c |
| 206 | } |
| 207 | |
| 208 | func compareInt(t *testing.T, want, got int) { |
| 209 | if want != got { |
no test coverage detected
searching dependent graphs…