From d8225d09e4aad44ad8858e6a00c1176e5a4876d7 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 26 Mar 2020 10:53:35 -0700 Subject: [PATCH 1/3] avoid using packages.Load fixed linting issues Add tests unexport error making it Windows compatible merge from upstream --- go.mod | 3 +- go.sum | 15 +++++-- mockgen/parse.go | 57 ++++++++++++++++--------- mockgen/parse_test.go | 69 +++++++++++++++++++++++++++++++ mockgen/testdata/gomod/bar/bar.go | 1 + mockgen/testdata/gomod/go.mod | 1 + 6 files changed, 122 insertions(+), 24 deletions(-) create mode 100644 mockgen/testdata/gomod/bar/bar.go create mode 100644 mockgen/testdata/gomod/go.mod diff --git a/go.mod b/go.mod index edfb6d40..76dfc0f5 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,8 @@ module github.com/golang/mock require ( - golang.org/x/tools v0.0.0-20190425150028-36563e24a262 + golang.org/x/mod v0.2.0 + golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e rsc.io/quote/v3 v3.1.0 ) diff --git a/go.sum b/go.sum index 0549f947..6f81be5f 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,20 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262 h1:qsl9y/CJx34tuA7QCPNp86JNJe4spst6Ff8MjvPUdPg= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e h1:aZzprAO9/8oim3qStq3wc1Xuxx4QmAGriC4VU4ojemQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= diff --git a/mockgen/parse.go b/mockgen/parse.go index 0ba7f805..8ceed121 100644 --- a/mockgen/parse.go +++ b/mockgen/parse.go @@ -26,13 +26,14 @@ import ( "go/token" "io/ioutil" "log" + "os" "path" "path/filepath" "strconv" "strings" "github.com/golang/mock/mockgen/model" - "golang.org/x/tools/go/packages" + "golang.org/x/mod/modfile" ) var ( @@ -49,7 +50,7 @@ func sourceMode(source string) (*model.Package, error) { return nil, fmt.Errorf("failed getting source directory: %v", err) } - packageImport, err := parsePackageImport(source, srcDir) + packageImport, err := parsePackageImport(srcDir) if err != nil { return nil, err } @@ -604,31 +605,49 @@ func packageNameOfDir(srcDir string) (string, error) { return "", fmt.Errorf("go source file not found %s", srcDir) } - packageImport, err := parsePackageImport(goFilePath, srcDir) + packageImport, err := parsePackageImport(srcDir) if err != nil { return "", err } return packageImport, nil } +var errOutsideGoPath = errors.New("Source directory is outside GOPATH") + // parseImportPackage get package import path via source file -func parsePackageImport(source, srcDir string) (string, error) { - cfg := &packages.Config{ - Mode: packages.NeedName, - Tests: true, - Dir: srcDir, +// an alternative implementation is to use: +// cfg := &packages.Config{Mode: packages.NeedName, Tests: true, Dir: srcDir} +// pkgs, err := packages.Load(cfg, "file="+source) +// However, it will call "go list" and slow down the performance +func parsePackageImport(srcDir string) (string, error) { + moduleMode := os.Getenv("GO111MODULE") + // trying to find the module + if moduleMode != "off" { + currentDir := srcDir + for { + dat, err := ioutil.ReadFile(filepath.Join(currentDir, "go.mod")) + if os.IsNotExist(err) { + if currentDir == filepath.Dir(currentDir) { + // at the root + break + } + currentDir = filepath.Dir(currentDir) + continue + } else if err != nil { + return "", err + } + modulePath := modfile.ModulePath(dat) + return filepath.ToSlash(filepath.Join(modulePath, strings.TrimPrefix(srcDir, currentDir))), nil + } } - pkgs, err := packages.Load(cfg, "file="+source) - if err != nil { - return "", err + // fall back to GOPATH mode + goPath := os.Getenv("GOPATH") + if goPath == "" { + return "", fmt.Errorf("GOPATH is not set") } - if packages.PrintErrors(pkgs) > 0 || len(pkgs) == 0 { - return "", errors.New("loading package failed") + sourceRoot := filepath.Join(goPath, "src") + string(os.PathSeparator) + if !strings.HasPrefix(srcDir, sourceRoot) { + return "", errOutsideGoPath } - - packageImport := pkgs[0].PkgPath - - // It is illegal to import a _test package. - packageImport = strings.TrimSuffix(packageImport, "_test") - return packageImport, nil + return filepath.ToSlash(strings.TrimPrefix(srcDir, sourceRoot)), nil } diff --git a/mockgen/parse_test.go b/mockgen/parse_test.go index e555b45e..8a72c06a 100644 --- a/mockgen/parse_test.go +++ b/mockgen/parse_test.go @@ -4,6 +4,9 @@ import ( "go/ast" "go/parser" "go/token" + "io/ioutil" + "os" + "path/filepath" "testing" ) @@ -113,3 +116,69 @@ func Benchmark_parseFile(b *testing.B) { sourceMode(source) } } + +func TestParsePackageImport(t *testing.T) { + for _, testCase := range []struct { + name string + envs map[string]string + dir string + pkgPath string + err error + }{ + { + name: "go mod default", + envs: map[string]string{"GO111MODULE": ""}, + dir: "testdata/gomod/bar", + pkgPath: "github.com/golang/foo/bar", + }, + { + name: "go mod off", + envs: map[string]string{"GO111MODULE": "off", "GOPATH": "testdata/gopath"}, + dir: "testdata/gopath/src/example.com/foo", + pkgPath: "example.com/foo", + }, + { + name: "outside GOPATH", + envs: map[string]string{"GO111MODULE": "off", "GOPATH": "testdata/gopath"}, + dir: "testdata", + err: errOutsideGoPath, + }, + } { + t.Run(testCase.name, func(t *testing.T) { + for key, value := range testCase.envs { + os.Setenv(key, value) + } + pkgPath, err := parsePackageImport(filepath.Clean(testCase.dir)) + if err != testCase.err { + t.Errorf("expect %v, got %v", testCase.err, err) + } + if pkgPath != testCase.pkgPath { + t.Errorf("expect %s, got %s", testCase.pkgPath, pkgPath) + } + }) + } +} + +func TestParsePackageImport_FallbackGoPath(t *testing.T) { + goPath, err := ioutil.TempDir("", "gopath") + if err != nil { + t.Error(err) + } + defer func() { + if err = os.RemoveAll(goPath); err != nil { + t.Error(err) + } + }() + srcDir := filepath.Join(goPath, "src/example.com/foo") + err = os.MkdirAll(srcDir, 0755) + if err != nil { + t.Error(err) + } + os.Setenv("GOPATH", goPath) + os.Setenv("GO111MODULE", "on") + pkgPath, err := parsePackageImport(srcDir) + expected := "example.com/foo" + if pkgPath != expected { + t.Errorf("expect %s, got %s", expected, pkgPath) + } +} diff --git a/mockgen/testdata/gomod/bar/bar.go b/mockgen/testdata/gomod/bar/bar.go new file mode 100644 index 00000000..ddac0faf --- /dev/null +++ b/mockgen/testdata/gomod/bar/bar.go @@ -0,0 +1 @@ +package bar diff --git a/mockgen/testdata/gomod/go.mod b/mockgen/testdata/gomod/go.mod new file mode 100644 index 00000000..d80591b4 --- /dev/null +++ b/mockgen/testdata/gomod/go.mod @@ -0,0 +1 @@ +module github.com/golang/foo From a68df0ab9e3aca2bf96c7a13f7839d4199627570 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Fri, 24 Apr 2020 14:09:14 -0700 Subject: [PATCH 2/3] fixed ci errors --- go.sum | 1 + .../bugreport_mock.go | 16 +++++++-------- .../import_embedded_interface/net_mock.go | 20 +++++++++---------- mockgen/testdata/gomod/go.mod | 2 ++ 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/go.sum b/go.sum index 6f81be5f..ac534ea2 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go b/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go index c618497a..9c308c1d 100644 --- a/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go +++ b/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go @@ -11,30 +11,30 @@ import ( reflect "reflect" ) -// MockSource is a mock of Source interface +// MockSource is a mock of Source interface. type MockSource struct { ctrl *gomock.Controller recorder *MockSourceMockRecorder } -// MockSourceMockRecorder is the mock recorder for MockSource +// MockSourceMockRecorder is the mock recorder for MockSource. type MockSourceMockRecorder struct { mock *MockSource } -// NewMockSource creates a new mock instance +// NewMockSource creates a new mock instance. func NewMockSource(ctrl *gomock.Controller) *MockSource { mock := &MockSource{ctrl: ctrl} mock.recorder = &MockSourceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSource) EXPECT() *MockSourceMockRecorder { return m.recorder } -// Ersatz mocks base method +// Ersatz mocks base method. func (m *MockSource) Ersatz() ersatz.Return { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Ersatz") @@ -42,13 +42,13 @@ func (m *MockSource) Ersatz() ersatz.Return { return ret0 } -// Ersatz indicates an expected call of Ersatz +// Ersatz indicates an expected call of Ersatz. func (mr *MockSourceMockRecorder) Ersatz() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ersatz", reflect.TypeOf((*MockSource)(nil).Ersatz)) } -// OtherErsatz mocks base method +// OtherErsatz mocks base method. func (m *MockSource) OtherErsatz() ersatz0.Return { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "OtherErsatz") @@ -56,7 +56,7 @@ func (m *MockSource) OtherErsatz() ersatz0.Return { return ret0 } -// OtherErsatz indicates an expected call of OtherErsatz +// OtherErsatz indicates an expected call of OtherErsatz. func (mr *MockSourceMockRecorder) OtherErsatz() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OtherErsatz", reflect.TypeOf((*MockSource)(nil).OtherErsatz)) diff --git a/mockgen/internal/tests/import_embedded_interface/net_mock.go b/mockgen/internal/tests/import_embedded_interface/net_mock.go index 50ec11ec..70bb9aa4 100644 --- a/mockgen/internal/tests/import_embedded_interface/net_mock.go +++ b/mockgen/internal/tests/import_embedded_interface/net_mock.go @@ -10,30 +10,30 @@ import ( reflect "reflect" ) -// MockNet is a mock of Net interface +// MockNet is a mock of Net interface. type MockNet struct { ctrl *gomock.Controller recorder *MockNetMockRecorder } -// MockNetMockRecorder is the mock recorder for MockNet +// MockNetMockRecorder is the mock recorder for MockNet. type MockNetMockRecorder struct { mock *MockNet } -// NewMockNet creates a new mock instance +// NewMockNet creates a new mock instance. func NewMockNet(ctrl *gomock.Controller) *MockNet { mock := &MockNet{ctrl: ctrl} mock.recorder = &MockNetMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockNet) EXPECT() *MockNetMockRecorder { return m.recorder } -// Header mocks base method +// Header mocks base method. func (m *MockNet) Header() http.Header { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Header") @@ -41,13 +41,13 @@ func (m *MockNet) Header() http.Header { return ret0 } -// Header indicates an expected call of Header +// Header indicates an expected call of Header. func (mr *MockNetMockRecorder) Header() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockNet)(nil).Header)) } -// Write mocks base method +// Write mocks base method. func (m *MockNet) Write(arg0 []byte) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Write", arg0) @@ -56,19 +56,19 @@ func (m *MockNet) Write(arg0 []byte) (int, error) { return ret0, ret1 } -// Write indicates an expected call of Write +// Write indicates an expected call of Write. func (mr *MockNetMockRecorder) Write(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockNet)(nil).Write), arg0) } -// WriteHeader mocks base method +// WriteHeader mocks base method. func (m *MockNet) WriteHeader(statusCode int) { m.ctrl.T.Helper() m.ctrl.Call(m, "WriteHeader", statusCode) } -// WriteHeader indicates an expected call of WriteHeader +// WriteHeader indicates an expected call of WriteHeader. func (mr *MockNetMockRecorder) WriteHeader(statusCode interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteHeader", reflect.TypeOf((*MockNet)(nil).WriteHeader), statusCode) diff --git a/mockgen/testdata/gomod/go.mod b/mockgen/testdata/gomod/go.mod index d80591b4..9e9d8332 100644 --- a/mockgen/testdata/gomod/go.mod +++ b/mockgen/testdata/gomod/go.mod @@ -1 +1,3 @@ module github.com/golang/foo + +go 1.14 From 47dadefd31c3eb2f832f82b5e2a3adceee94713b Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Mon, 18 May 2020 15:30:52 -0700 Subject: [PATCH 3/3] Dynamically creating testdata --- go.mod | 2 +- go.sum | 4 ++-- mockgen/parse_test.go | 28 ++++++++++++++++++++++++---- mockgen/testdata/gomod/bar/bar.go | 1 - mockgen/testdata/gomod/go.mod | 3 --- 5 files changed, 27 insertions(+), 11 deletions(-) delete mode 100644 mockgen/testdata/gomod/bar/bar.go delete mode 100644 mockgen/testdata/gomod/go.mod diff --git a/go.mod b/go.mod index 76dfc0f5..5932535f 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/golang/mock require ( - golang.org/x/mod v0.2.0 + golang.org/x/mod v0.3.0 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e rsc.io/quote/v3 v3.1.0 ) diff --git a/go.sum b/go.sum index ac534ea2..2511fffe 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= diff --git a/mockgen/parse_test.go b/mockgen/parse_test.go index 8a72c06a..a274d8e0 100644 --- a/mockgen/parse_test.go +++ b/mockgen/parse_test.go @@ -118,6 +118,26 @@ func Benchmark_parseFile(b *testing.B) { } func TestParsePackageImport(t *testing.T) { + testRoot, err := ioutil.TempDir("", "test_root") + if err != nil { + t.Fatal("cannot create tempdir") + } + defer func() { + if err = os.RemoveAll(testRoot); err != nil { + t.Errorf("cannot clean up tempdir at %s: %v", testRoot, err) + } + }() + barDir := filepath.Join(testRoot, "gomod/bar") + if err = os.MkdirAll(barDir, 0755); err != nil { + t.Fatalf("error creating %s: %v", barDir, err) + } + if err = ioutil.WriteFile(filepath.Join(barDir, "bar.go"), []byte("package bar"), 0644); err != nil { + t.Fatalf("error creating gomod/bar/bar.go: %v", err) + } + if err = ioutil.WriteFile(filepath.Join(testRoot, "gomod/go.mod"), []byte("module github.com/golang/foo"), 0644); err != nil { + t.Fatalf("error creating gomod/go.mod: %v", err) + } + goPath := filepath.Join(testRoot, "gopath") for _, testCase := range []struct { name string envs map[string]string @@ -128,18 +148,18 @@ func TestParsePackageImport(t *testing.T) { { name: "go mod default", envs: map[string]string{"GO111MODULE": ""}, - dir: "testdata/gomod/bar", + dir: barDir, pkgPath: "github.com/golang/foo/bar", }, { name: "go mod off", - envs: map[string]string{"GO111MODULE": "off", "GOPATH": "testdata/gopath"}, - dir: "testdata/gopath/src/example.com/foo", + envs: map[string]string{"GO111MODULE": "off", "GOPATH": goPath}, + dir: filepath.Join(testRoot, "gopath/src/example.com/foo"), pkgPath: "example.com/foo", }, { name: "outside GOPATH", - envs: map[string]string{"GO111MODULE": "off", "GOPATH": "testdata/gopath"}, + envs: map[string]string{"GO111MODULE": "off", "GOPATH": goPath}, dir: "testdata", err: errOutsideGoPath, }, diff --git a/mockgen/testdata/gomod/bar/bar.go b/mockgen/testdata/gomod/bar/bar.go deleted file mode 100644 index ddac0faf..00000000 --- a/mockgen/testdata/gomod/bar/bar.go +++ /dev/null @@ -1 +0,0 @@ -package bar diff --git a/mockgen/testdata/gomod/go.mod b/mockgen/testdata/gomod/go.mod deleted file mode 100644 index 9e9d8332..00000000 --- a/mockgen/testdata/gomod/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/golang/foo - -go 1.14