From 73d636f7d7adf159e26f35f37aba514f647492ce Mon Sep 17 00:00:00 2001 From: aarzilli Date: Tue, 6 Nov 2018 12:11:51 +0100 Subject: [PATCH] tests: rename _fixtures/vendor to _fixtures/internal Some tests used a fake vendor directory placed inside _fixtures to import some support packages. In go.mod mode vendor directory are only supported on the root of the project, which breaks some of our tests. Since vendor directories outside the root of the project are so rare anyway it's possible that a future version of go will stop supporting it even in GOPATH mode. Also it was weird and unnecessary in the first place anyawy. --- _fixtures/consts.go | 2 +- _fixtures/dotpackagesiface.go | 4 ++-- _fixtures/{vendor => internal}/dir.io/dir.go | 0 .../{vendor => internal}/dir.io/io.io/io.go | 0 .../{vendor => internal}/dir0/pkg/main.go | 0 .../dir0/renamedpackage/main.go | 0 .../{vendor => internal}/dir1/pkg/main.go | 0 _fixtures/pkgrenames.go | 6 ++--- service/test/variables_test.go | 24 +++++++++---------- 9 files changed, 18 insertions(+), 18 deletions(-) rename _fixtures/{vendor => internal}/dir.io/dir.go (100%) rename _fixtures/{vendor => internal}/dir.io/io.io/io.go (100%) rename _fixtures/{vendor => internal}/dir0/pkg/main.go (100%) rename _fixtures/{vendor => internal}/dir0/renamedpackage/main.go (100%) rename _fixtures/{vendor => internal}/dir1/pkg/main.go (100%) diff --git a/_fixtures/consts.go b/_fixtures/consts.go index 531a27db..54bfa8b2 100644 --- a/_fixtures/consts.go +++ b/_fixtures/consts.go @@ -1,8 +1,8 @@ package main import ( - "dir0/pkg" "fmt" + "github.com/derekparker/delve/_fixtures/internal/dir0/pkg" "runtime" ) diff --git a/_fixtures/dotpackagesiface.go b/_fixtures/dotpackagesiface.go index 5ad147c2..5952ebeb 100644 --- a/_fixtures/dotpackagesiface.go +++ b/_fixtures/dotpackagesiface.go @@ -1,9 +1,9 @@ package main import ( - "dir.io" - "dir.io/io.io" "fmt" + "github.com/derekparker/delve/_fixtures/internal/dir.io" + "github.com/derekparker/delve/_fixtures/internal/dir.io/io.io" "runtime" ) diff --git a/_fixtures/vendor/dir.io/dir.go b/_fixtures/internal/dir.io/dir.go similarity index 100% rename from _fixtures/vendor/dir.io/dir.go rename to _fixtures/internal/dir.io/dir.go diff --git a/_fixtures/vendor/dir.io/io.io/io.go b/_fixtures/internal/dir.io/io.io/io.go similarity index 100% rename from _fixtures/vendor/dir.io/io.io/io.go rename to _fixtures/internal/dir.io/io.io/io.go diff --git a/_fixtures/vendor/dir0/pkg/main.go b/_fixtures/internal/dir0/pkg/main.go similarity index 100% rename from _fixtures/vendor/dir0/pkg/main.go rename to _fixtures/internal/dir0/pkg/main.go diff --git a/_fixtures/vendor/dir0/renamedpackage/main.go b/_fixtures/internal/dir0/renamedpackage/main.go similarity index 100% rename from _fixtures/vendor/dir0/renamedpackage/main.go rename to _fixtures/internal/dir0/renamedpackage/main.go diff --git a/_fixtures/vendor/dir1/pkg/main.go b/_fixtures/internal/dir1/pkg/main.go similarity index 100% rename from _fixtures/vendor/dir1/pkg/main.go rename to _fixtures/internal/dir1/pkg/main.go diff --git a/_fixtures/pkgrenames.go b/_fixtures/pkgrenames.go index d315e6b7..6e0882dc 100644 --- a/_fixtures/pkgrenames.go +++ b/_fixtures/pkgrenames.go @@ -8,9 +8,9 @@ import ( pkg1 "go/ast" pkg2 "net/http" - "dir0/pkg" - "dir0/renamedpackage" - dir1pkg "dir1/pkg" + "github.com/derekparker/delve/_fixtures/internal/dir0/pkg" + "github.com/derekparker/delve/_fixtures/internal/dir0/renamedpackage" + dir1pkg "github.com/derekparker/delve/_fixtures/internal/dir1/pkg" ) func main() { diff --git a/service/test/variables_test.go b/service/test/variables_test.go index 83fb6e7a..0e29202a 100644 --- a/service/test/variables_test.go +++ b/service/test/variables_test.go @@ -978,20 +978,20 @@ func TestPackageRenames(t *testing.T) { {"amap", true, "interface {}(map[go/ast.BadExpr]net/http.Request) [{From: 2, To: 3}: *{Method: \"othermethod\", …", "", "interface {}", nil}, // Package name that doesn't match import path - {"iface3", true, `interface {}(*github.com/derekparker/delve/_fixtures/vendor/dir0/renamedpackage.SomeType) *{A: true}`, "", "interface {}", nil}, + {"iface3", true, `interface {}(*github.com/derekparker/delve/_fixtures/internal/dir0/renamedpackage.SomeType) *{A: true}`, "", "interface {}", nil}, // Interfaces to anonymous types {"amap2", true, "interface {}(*map[go/ast.BadExpr]net/http.Request) *[{From: 2, To: 3}: *{Method: \"othermethod\", …", "", "interface {}", nil}, - {"dir0someType", true, "interface {}(*github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType) *{X: 3}", "", "interface {}", nil}, - {"dir1someType", true, "interface {}(github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType) {X: 1, Y: 2}", "", "interface {}", nil}, - {"amap3", true, "interface {}(map[github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType]github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType) [{X: 4}: {X: 5, Y: 6}, ]", "", "interface {}", nil}, - {"anarray", true, `interface {}([2]github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType) [{X: 1},{X: 2}]`, "", "interface {}", nil}, - {"achan", true, `interface {}(chan github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType) chan github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType 0/0`, "", "interface {}", nil}, - {"aslice", true, `interface {}([]github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType) [{X: 3},{X: 4}]`, "", "interface {}", nil}, - {"afunc", true, `interface {}(func(github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType, github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType)) main.main.func1`, "", "interface {}", nil}, - {"astruct", true, `interface {}(*struct { A github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType; B github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType }) *{A: github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType {X: 1, Y: 2}, B: github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType {X: 3}}`, "", "interface {}", nil}, - {"astruct2", true, `interface {}(*struct { github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType; X int }) *{SomeType: github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}`, "", "interface {}", nil}, - {"iface2iface", true, `interface {}(*interface { AMethod(int) int; AnotherMethod(int) int }) **github.com/derekparker/delve/_fixtures/vendor/dir0/pkg.SomeType {X: 4}`, "", "interface {}", nil}, + {"dir0someType", true, "interface {}(*github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType) *{X: 3}", "", "interface {}", nil}, + {"dir1someType", true, "interface {}(github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType) {X: 1, Y: 2}", "", "interface {}", nil}, + {"amap3", true, "interface {}(map[github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType]github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType) [{X: 4}: {X: 5, Y: 6}, ]", "", "interface {}", nil}, + {"anarray", true, `interface {}([2]github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType) [{X: 1},{X: 2}]`, "", "interface {}", nil}, + {"achan", true, `interface {}(chan github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType) chan github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType 0/0`, "", "interface {}", nil}, + {"aslice", true, `interface {}([]github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType) [{X: 3},{X: 4}]`, "", "interface {}", nil}, + {"afunc", true, `interface {}(func(github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType, github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType)) main.main.func1`, "", "interface {}", nil}, + {"astruct", true, `interface {}(*struct { A github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType; B github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType }) *{A: github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, B: github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType {X: 3}}`, "", "interface {}", nil}, + {"astruct2", true, `interface {}(*struct { github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType; X int }) *{SomeType: github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}`, "", "interface {}", nil}, + {"iface2iface", true, `interface {}(*interface { AMethod(int) int; AnotherMethod(int) int }) **github.com/derekparker/delve/_fixtures/internal/dir0/pkg.SomeType {X: 4}`, "", "interface {}", nil}, {`"dir0/pkg".A`, false, "0", "", "int", nil}, {`"dir1/pkg".A`, false, "1", "", "int", nil}, @@ -1010,7 +1010,7 @@ func TestPackageRenames(t *testing.T) { if ver.Major > 0 && !ver.AfterOrEqual(goversion.GoVersion{1, 9, -1, 0, 0, ""}) { // before 1.9 embedded struct field have fieldname == type if tc.name == "astruct2" { - tc.value = `interface {}(*struct { github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType; X int }) *{github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType: github.com/derekparker/delve/_fixtures/vendor/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}` + tc.value = `interface {}(*struct { github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType; X int }) *{github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType: github.com/derekparker/delve/_fixtures/internal/dir1/pkg.SomeType {X: 1, Y: 2}, X: 10}` } } variable, err := evalVariable(p, tc.name, pnormalLoadConfig)