@@ -16,81 +16,86 @@ func TestGetEnabledLintersSet(t *testing.T) {
1616 def []string // enabled by default linters
1717 exp []string // alphabetically ordered enabled linter names
1818 }
19+
1920 allMegacheckLinterNames := []string {"gosimple" , "staticcheck" , "unused" }
21+
2022 cases := []cs {
2123 {
2224 cfg : config.Linters {
2325 Disable : []string {"megacheck" },
2426 },
2527 name : "disable all linters from megacheck" ,
2628 def : allMegacheckLinterNames ,
27- exp : nil , // all disabled
29+ exp : [] string { "typecheck" } , // all disabled
2830 },
2931 {
3032 cfg : config.Linters {
3133 Disable : []string {"staticcheck" },
3234 },
3335 name : "disable only staticcheck" ,
3436 def : allMegacheckLinterNames ,
35- exp : []string {"gosimple" , "unused" },
37+ exp : []string {"gosimple" , "typecheck" , " unused" },
3638 },
3739 {
3840 name : "don't merge into megacheck" ,
3941 def : allMegacheckLinterNames ,
40- exp : allMegacheckLinterNames ,
42+ exp : [] string { "gosimple" , "staticcheck" , "typecheck" , "unused" } ,
4143 },
4244 {
4345 name : "expand megacheck" ,
4446 cfg : config.Linters {
4547 Enable : []string {"megacheck" },
4648 },
4749 def : nil ,
48- exp : allMegacheckLinterNames ,
50+ exp : [] string { "gosimple" , "staticcheck" , "typecheck" , "unused" } ,
4951 },
5052 {
5153 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" },
5456 },
5557 {
5658 name : "enable gosec by gas alias" ,
5759 cfg : config.Linters {
5860 Enable : []string {"gas" },
5961 },
60- exp : []string {"gosec" },
62+ exp : []string {"gosec" , "typecheck" },
6163 },
6264 {
6365 name : "enable gosec by primary name" ,
6466 cfg : config.Linters {
6567 Enable : []string {"gosec" },
6668 },
67- exp : []string {"gosec" },
69+ exp : []string {"gosec" , "typecheck" },
6870 },
6971 {
7072 name : "enable gosec by both names" ,
7173 cfg : config.Linters {
7274 Enable : []string {"gosec" , "gas" },
7375 },
74- exp : []string {"gosec" },
76+ exp : []string {"gosec" , "typecheck" },
7577 },
7678 {
7779 name : "disable gosec by gas alias" ,
7880 cfg : config.Linters {
7981 Disable : []string {"gas" },
8082 },
8183 def : []string {"gosec" },
84+ exp : []string {"typecheck" },
8285 },
8386 {
8487 name : "disable gosec by primary name" ,
8588 cfg : config.Linters {
8689 Disable : []string {"gosec" },
8790 },
8891 def : []string {"gosec" },
92+ exp : []string {"typecheck" },
8993 },
9094 }
9195
9296 m := NewManager (nil , nil )
9397 es := NewEnabledSet (m , NewValidator (m ), nil , nil )
98+
9499 for _ , c := range cases {
95100 c := c
96101 t .Run (c .name , func (t * testing.T ) {
0 commit comments