@@ -6,14 +6,12 @@ import (
6
6
"path/filepath"
7
7
"testing"
8
8
9
- "github.com/golangci/golangci-lint/pkg/lint/lintersdb"
10
-
11
- "github.com/golang/mock/gomock"
12
9
"github.com/stretchr/testify/assert"
10
+ "github.com/stretchr/testify/mock"
13
11
14
12
"github.com/golangci/golangci-lint/pkg/lint/astcache"
13
+ "github.com/golangci/golangci-lint/pkg/lint/lintersdb"
15
14
"github.com/golangci/golangci-lint/pkg/logutils"
16
- "github.com/golangci/golangci-lint/pkg/logutils/mock_logutils"
17
15
"github.com/golangci/golangci-lint/pkg/result"
18
16
)
19
17
@@ -43,18 +41,15 @@ func newTestNolintProcessor(log logutils.Log) *Nolint {
43
41
return NewNolint (cache , log , lintersdb .NewManager (nil ))
44
42
}
45
43
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 ()
49
47
return log
50
48
}
51
49
52
50
//nolint:funlen
53
51
func TestNolint (t * testing.T ) {
54
- ctrl := gomock .NewController (t )
55
- defer ctrl .Finish ()
56
-
57
- p := newTestNolintProcessor (getOkLogger (ctrl ))
52
+ p := newTestNolintProcessor (getMockLog ())
58
53
defer p .Finish ()
59
54
60
55
// test inline comments
@@ -152,21 +147,16 @@ func TestNolintInvalidLinterName(t *testing.T) {
152
147
},
153
148
}
154
149
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" )
159
152
160
153
p := newTestNolintProcessor (log )
161
154
processAssertEmpty (t , p , issues ... )
162
155
p .Finish ()
163
156
}
164
157
165
158
func TestNolintAliases (t * testing.T ) {
166
- ctrl := gomock .NewController (t )
167
- defer ctrl .Finish ()
168
-
169
- p := newTestNolintProcessor (getOkLogger (ctrl ))
159
+ p := newTestNolintProcessor (getMockLog ())
170
160
for _ , line := range []int {47 , 49 , 51 } {
171
161
line := line
172
162
t .Run (fmt .Sprintf ("line-%d" , line ), func (t * testing.T ) {
0 commit comments