funcname = f[0]
pathAndLineNo := f[1]
f = strings.Split(pathAndLineNo, ":")
- if runtime.GOOS == "windows" {
- switch len(f) {
- case 2:
- return funcname, f[0], f[1]
- case 3:
- return funcname, f[0] + ":" + f[1], f[2]
- default:
- t.Fatalf("no line number found in %q", pathAndLineNo)
- }
+ if runtime.GOOS == "windows" && len(f) == 3 {
+ // Reattach drive letter.
+ f = []string{f[0] + ":" + f[1], f[2]}
}
if len(f) != 2 {
t.Fatalf("no line number found in %q", pathAndLineNo)
if !os.SameFile(fi1, fi2) {
t.Fatalf("addr2line_test.go and %s are not same file", srcPath)
}
- if srcLineNo != "95" {
- t.Fatalf("line number = %v; want 95", srcLineNo)
+ if srcLineNo != "89" {
+ t.Fatalf("line number = %v; want 89", srcLineNo)
}
}
-// This is line 94. The test depends on that.
+// This is line 88. The test depends on that.
func TestAddr2Line(t *testing.T) {
testenv.MustHaveGoBuild(t)