@@ -6,14 +6,12 @@ import (
66 "path/filepath"
77 "testing"
88
9- "github.com/golangci/golangci-lint/pkg/lint/lintersdb"
10-
11- "github.com/golang/mock/gomock"
129 "github.com/stretchr/testify/assert"
10+ "github.com/stretchr/testify/mock"
1311
1412 "github.com/golangci/golangci-lint/pkg/lint/astcache"
13+ "github.com/golangci/golangci-lint/pkg/lint/lintersdb"
1514 "github.com/golangci/golangci-lint/pkg/logutils"
16- "github.com/golangci/golangci-lint/pkg/logutils/mock_logutils"
1715 "github.com/golangci/golangci-lint/pkg/result"
1816)
1917
@@ -43,18 +41,15 @@ func newTestNolintProcessor(log logutils.Log) *Nolint {
4341 return NewNolint (cache , log , lintersdb .NewManager (nil ))
4442}
4543
46- func getOkLogger ( ctrl * gomock. Controller ) * mock_logutils .MockLog {
47- log := mock_logutils .NewMockLog (ctrl )
48- log .EXPECT (). Infof ( gomock . Any (), gomock . Any ()). AnyTimes ()
44+ func getMockLog ( ) * logutils .MockLog {
45+ log := logutils .NewMockLog ()
46+ log .On ( " Infof" , mock . Anything , mock . Anything ). Maybe ()
4947 return log
5048}
5149
5250//nolint:funlen
5351func TestNolint (t * testing.T ) {
54- ctrl := gomock .NewController (t )
55- defer ctrl .Finish ()
56-
57- p := newTestNolintProcessor (getOkLogger (ctrl ))
52+ p := newTestNolintProcessor (getMockLog ())
5853 defer p .Finish ()
5954
6055 // test inline comments
@@ -152,21 +147,16 @@ func TestNolintInvalidLinterName(t *testing.T) {
152147 },
153148 }
154149
155- ctrl := gomock .NewController (t )
156- defer ctrl .Finish ()
157- log := getOkLogger (ctrl )
158- log .EXPECT ().Warnf ("Found unknown linters in //nolint directives: %s" , "bad1, bad2" )
150+ log := getMockLog ()
151+ log .On ("Warnf" , "Found unknown linters in //nolint directives: %s" , "bad1, bad2" )
159152
160153 p := newTestNolintProcessor (log )
161154 processAssertEmpty (t , p , issues ... )
162155 p .Finish ()
163156}
164157
165158func TestNolintAliases (t * testing.T ) {
166- ctrl := gomock .NewController (t )
167- defer ctrl .Finish ()
168-
169- p := newTestNolintProcessor (getOkLogger (ctrl ))
159+ p := newTestNolintProcessor (getMockLog ())
170160 for _ , line := range []int {47 , 49 , 51 } {
171161 line := line
172162 t .Run (fmt .Sprintf ("line-%d" , line ), func (t * testing.T ) {
0 commit comments