@@ -16,81 +16,86 @@ func TestGetEnabledLintersSet(t *testing.T) {
16
16
def []string // enabled by default linters
17
17
exp []string // alphabetically ordered enabled linter names
18
18
}
19
+
19
20
allMegacheckLinterNames := []string {"gosimple" , "staticcheck" , "unused" }
21
+
20
22
cases := []cs {
21
23
{
22
24
cfg : config.Linters {
23
25
Disable : []string {"megacheck" },
24
26
},
25
27
name : "disable all linters from megacheck" ,
26
28
def : allMegacheckLinterNames ,
27
- exp : nil , // all disabled
29
+ exp : [] string { "typecheck" } , // all disabled
28
30
},
29
31
{
30
32
cfg : config.Linters {
31
33
Disable : []string {"staticcheck" },
32
34
},
33
35
name : "disable only staticcheck" ,
34
36
def : allMegacheckLinterNames ,
35
- exp : []string {"gosimple" , "unused" },
37
+ exp : []string {"gosimple" , "typecheck" , " unused" },
36
38
},
37
39
{
38
40
name : "don't merge into megacheck" ,
39
41
def : allMegacheckLinterNames ,
40
- exp : allMegacheckLinterNames ,
42
+ exp : [] string { "gosimple" , "staticcheck" , "typecheck" , "unused" } ,
41
43
},
42
44
{
43
45
name : "expand megacheck" ,
44
46
cfg : config.Linters {
45
47
Enable : []string {"megacheck" },
46
48
},
47
49
def : nil ,
48
- exp : allMegacheckLinterNames ,
50
+ exp : [] string { "gosimple" , "staticcheck" , "typecheck" , "unused" } ,
49
51
},
50
52
{
51
53
name : "don't disable anything" ,
52
- def : []string {"gofmt" , "govet" },
53
- exp : []string {"gofmt" , "govet" },
54
+ def : []string {"gofmt" , "govet" , "typecheck" },
55
+ exp : []string {"gofmt" , "govet" , "typecheck" },
54
56
},
55
57
{
56
58
name : "enable gosec by gas alias" ,
57
59
cfg : config.Linters {
58
60
Enable : []string {"gas" },
59
61
},
60
- exp : []string {"gosec" },
62
+ exp : []string {"gosec" , "typecheck" },
61
63
},
62
64
{
63
65
name : "enable gosec by primary name" ,
64
66
cfg : config.Linters {
65
67
Enable : []string {"gosec" },
66
68
},
67
- exp : []string {"gosec" },
69
+ exp : []string {"gosec" , "typecheck" },
68
70
},
69
71
{
70
72
name : "enable gosec by both names" ,
71
73
cfg : config.Linters {
72
74
Enable : []string {"gosec" , "gas" },
73
75
},
74
- exp : []string {"gosec" },
76
+ exp : []string {"gosec" , "typecheck" },
75
77
},
76
78
{
77
79
name : "disable gosec by gas alias" ,
78
80
cfg : config.Linters {
79
81
Disable : []string {"gas" },
80
82
},
81
83
def : []string {"gosec" },
84
+ exp : []string {"typecheck" },
82
85
},
83
86
{
84
87
name : "disable gosec by primary name" ,
85
88
cfg : config.Linters {
86
89
Disable : []string {"gosec" },
87
90
},
88
91
def : []string {"gosec" },
92
+ exp : []string {"typecheck" },
89
93
},
90
94
}
91
95
92
96
m := NewManager (nil , nil )
93
97
es := NewEnabledSet (m , NewValidator (m ), nil , nil )
98
+
94
99
for _ , c := range cases {
95
100
c := c
96
101
t .Run (c .name , func (t * testing.T ) {
0 commit comments