From 473acc61c8392dc7ae303d91568e179c4f105a76 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 2 Jul 2019 12:12:53 +0200 Subject: add black list --- .../mockgen/tests/custom_package_name/README.md | 22 ----------- .../tests/custom_package_name/client/v1/client.go | 13 ------ .../tests/custom_package_name/greeter/greeter.go | 31 --------------- .../greeter/greeter_mock_test.go | 46 ---------------------- .../custom_package_name/greeter/greeter_test.go | 37 ----------------- .../custom_package_name/validator/validate.go | 5 --- 6 files changed, 154 deletions(-) delete mode 100644 vendor/github.com/golang/mock/mockgen/tests/custom_package_name/README.md delete mode 100644 vendor/github.com/golang/mock/mockgen/tests/custom_package_name/client/v1/client.go delete mode 100644 vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter.go delete mode 100644 vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_mock_test.go delete mode 100644 vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_test.go delete mode 100644 vendor/github.com/golang/mock/mockgen/tests/custom_package_name/validator/validate.go (limited to 'vendor/github.com/golang/mock/mockgen/tests/custom_package_name') diff --git a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/README.md b/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/README.md deleted file mode 100644 index b16da21..0000000 --- a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Tests for custom package names - -This directory contains test for mockgen generating mocks when imported package -name does not match import path suffix. For example, package with name "client" -is located under import path "github.com/golang/mock/mockgen/tests/custom_package_name/client/v1". - -Prior to this patch: - - $ go generate greeter/greeter.go - 2018/03/05 22:44:52 Loading input failed: greeter.go:17:11: failed parsing returns: greeter.go:17:14: unknown package "client" - greeter/greeter.go:1: running "mockgen": exit status 1 - -This can be fixed by manually providing `-imports` flag, like `-imports client=github.com/golang/mock/mockgen/tests/custom_package_name/client/v1`. -But, mockgen should be able to automatically resolve package names in such situations. - -With this patch applied: - - $ go generate greeter/greeter.go - $ echo $? - 0 - -Mockgen runs successfully, produced output is equal to [greeter_mock_test.go](greeter/greeter_mock_test.go) content. diff --git a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/client/v1/client.go b/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/client/v1/client.go deleted file mode 100644 index fc799d9..0000000 --- a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/client/v1/client.go +++ /dev/null @@ -1,13 +0,0 @@ -package client - -import "fmt" - -type Client struct{} - -func (c *Client) Greet(in GreetInput) string { - return fmt.Sprintf("Hello, %s!", in.Name) -} - -type GreetInput struct { - Name string -} diff --git a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter.go b/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter.go deleted file mode 100644 index 8c2d293..0000000 --- a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter.go +++ /dev/null @@ -1,31 +0,0 @@ -//go:generate mockgen -source greeter.go -destination greeter_mock_test.go -package greeter - -package greeter - -import ( - // stdlib import - "fmt" - - // non-matching import suffix and package name - "github.com/golang/mock/mockgen/tests/custom_package_name/client/v1" - - // matching import suffix and package name - "github.com/golang/mock/mockgen/tests/custom_package_name/validator" -) - -type InputMaker interface { - MakeInput() client.GreetInput -} - -type Greeter struct { - InputMaker InputMaker - Client *client.Client -} - -func (g *Greeter) Greet() (string, error) { - in := g.InputMaker.MakeInput() - if err := validator.Validate(in.Name); err != nil { - return "", fmt.Errorf("validation failed: %v", err) - } - return g.Client.Greet(in), nil -} diff --git a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_mock_test.go b/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_mock_test.go deleted file mode 100644 index 0bf0f46..0000000 --- a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_mock_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: greeter.go - -// Package greeter is a generated GoMock package. -package greeter - -import ( - gomock "github.com/golang/mock/gomock" - v1 "github.com/golang/mock/mockgen/tests/custom_package_name/client/v1" - reflect "reflect" -) - -// MockInputMaker is a mock of InputMaker interface -type MockInputMaker struct { - ctrl *gomock.Controller - recorder *MockInputMakerMockRecorder -} - -// MockInputMakerMockRecorder is the mock recorder for MockInputMaker -type MockInputMakerMockRecorder struct { - mock *MockInputMaker -} - -// NewMockInputMaker creates a new mock instance -func NewMockInputMaker(ctrl *gomock.Controller) *MockInputMaker { - mock := &MockInputMaker{ctrl: ctrl} - mock.recorder = &MockInputMakerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockInputMaker) EXPECT() *MockInputMakerMockRecorder { - return m.recorder -} - -// MakeInput mocks base method -func (m *MockInputMaker) MakeInput() v1.GreetInput { - ret := m.ctrl.Call(m, "MakeInput") - ret0, _ := ret[0].(v1.GreetInput) - return ret0 -} - -// MakeInput indicates an expected call of MakeInput -func (mr *MockInputMakerMockRecorder) MakeInput() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeInput", reflect.TypeOf((*MockInputMaker)(nil).MakeInput)) -} diff --git a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_test.go b/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_test.go deleted file mode 100644 index f056ec8..0000000 --- a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/greeter/greeter_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package greeter - -import ( - "testing" - - "github.com/golang/mock/gomock" - "github.com/golang/mock/mockgen/tests/custom_package_name/client/v1" -) - -func TestGreeter_Greet(t *testing.T) { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - input := client.GreetInput{ - Name: "Foo", - } - - inputMaker := NewMockInputMaker(ctrl) - inputMaker.EXPECT(). - MakeInput(). - Return(input) - - g := &Greeter{ - InputMaker: inputMaker, - Client: &client.Client{}, - } - - greeting, err := g.Greet() - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - expected := "Hello, Foo!" - if greeting != expected { - t.Fatalf("Expected greeting to be %v but got %v", expected, greeting) - } -} diff --git a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/validator/validate.go b/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/validator/validate.go deleted file mode 100644 index 0617c4b..0000000 --- a/vendor/github.com/golang/mock/mockgen/tests/custom_package_name/validator/validate.go +++ /dev/null @@ -1,5 +0,0 @@ -package validator - -func Validate(s string) error { - return nil -} -- cgit v1.2.3