diff --git a/_fixtures/dotpackagesiface.go b/_fixtures/dotpackagesiface.go new file mode 100644 index 00000000..5ad147c2 --- /dev/null +++ b/_fixtures/dotpackagesiface.go @@ -0,0 +1,15 @@ +package main + +import ( + "dir.io" + "dir.io/io.io" + "fmt" + "runtime" +) + +func main() { + var iface interface{} = &dirio.SomeType{} + var iface2 interface{} = &ioio.SomeOtherType{} + runtime.Breakpoint() + fmt.Println(iface, iface2) +} diff --git a/_fixtures/vendor/dir.io/dir.go b/_fixtures/vendor/dir.io/dir.go new file mode 100644 index 00000000..3ce3c9e8 --- /dev/null +++ b/_fixtures/vendor/dir.io/dir.go @@ -0,0 +1,5 @@ +package dirio + +type SomeType struct { + X int +} diff --git a/_fixtures/vendor/dir.io/io.io/io.go b/_fixtures/vendor/dir.io/io.io/io.go new file mode 100644 index 00000000..7627c99c --- /dev/null +++ b/_fixtures/vendor/dir.io/io.io/io.go @@ -0,0 +1,5 @@ +package ioio + +type SomeOtherType struct { + Y int +} diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index 938a4993..ab6c9438 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -3400,3 +3400,13 @@ func TestDeclLine(t *testing.T) { } }) } + +func TestIssue1137(t *testing.T) { + withTestProcess("dotpackagesiface", t, func(p proc.Process, fixture protest.Fixture) { + assertNoError(proc.Continue(p), t, "Continue()") + v := evalVariable(p, t, "iface") + assertNoError(v.Unreadable, t, "iface unreadable") + v2 := evalVariable(p, t, "iface2") + assertNoError(v2.Unreadable, t, "iface2 unreadable") + }) +} diff --git a/pkg/proc/types.go b/pkg/proc/types.go index 114cd5db..868f10fa 100644 --- a/pkg/proc/types.go +++ b/pkg/proc/types.go @@ -435,6 +435,12 @@ func nameOfNamedRuntimeType(_type *Variable, kind, tflag int64) (typename string if err != nil { return "", err } + if slash := strings.LastIndex(pkgPath, "/"); slash >= 0 { + fixedName := strings.Replace(pkgPath[slash+1:], ".", "%2e", -1) + if fixedName != pkgPath[slash+1:] { + pkgPath = pkgPath[:slash+1] + fixedName + } + } typename = pkgPath + "." + typename } }