Skip to content

Commit 45053ec

Browse files
committed
fix: typecheck doesn't need a specific loadMode
1 parent 9ccb20d commit 45053ec

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

pkg/golinters/typecheck.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ func NewTypecheck() *goanalysis.Linter {
2020
"Like the front-end of a Go compiler, parses and type-checks Go code",
2121
[]*analysis.Analyzer{analyzer},
2222
nil,
23-
).WithLoadMode(goanalysis.LoadModeTypesInfo)
23+
).WithLoadMode(goanalysis.LoadModeNone)
2424
}

pkg/lint/lintersdb/builder_linter.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
751751
linter.NewConfig(golinters.NewTypecheck()).
752752
WithInternal().
753753
WithEnabledByDefault().
754-
WithSince("v1.3.0").
755-
WithLoadForGoAnalysis().
756-
WithPresets(linter.PresetBugs).
757-
WithURL(""),
754+
WithSince("v1.3.0"),
758755

759756
linter.NewConfig(unconvert.New(&cfg.LintersSettings.Unconvert)).
760757
WithSince("v1.0.0").

pkg/lint/lintersdb/manager_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ func TestManager_GetOptimizedLinters(t *testing.T) {
5555

5656
mlConfig := &linter.Config{
5757
Linter: goanalysis.NewMetaLinter(gaLinters),
58-
InPresets: []string{"bugs", "format"},
58+
InPresets: []string{"format"},
5959
}
6060

61-
expected := []*linter.Config{mlConfig.WithLoadForGoAnalysis()}
61+
expected := []*linter.Config{mlConfig.WithLoadFiles()}
6262

6363
assert.Equal(t, expected, optimizedLinters)
6464
}

test/enabled_linters_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func getEnabledByDefaultFastLintersExcept(t *testing.T, except ...string) []stri
148148
ebdl := m.GetAllEnabledByDefaultLinters()
149149
var ret []string
150150
for _, lc := range ebdl {
151-
if lc.IsSlowLinter() {
151+
if lc.IsSlowLinter() || lc.Internal {
152152
continue
153153
}
154154

@@ -169,7 +169,7 @@ func getAllFastLintersWith(t *testing.T, with ...string) []string {
169169
linters := dbManager.GetAllSupportedLinterConfigs()
170170
ret := append([]string{}, with...)
171171
for _, lc := range linters {
172-
if lc.IsSlowLinter() {
172+
if lc.IsSlowLinter() || lc.Internal {
173173
continue
174174
}
175175
ret = append(ret, lc.Name())
@@ -206,7 +206,7 @@ func getEnabledByDefaultFastLintersWith(t *testing.T, with ...string) []string {
206206
ebdl := dbManager.GetAllEnabledByDefaultLinters()
207207
ret := append([]string{}, with...)
208208
for _, lc := range ebdl {
209-
if lc.IsSlowLinter() {
209+
if lc.IsSlowLinter() || lc.Internal {
210210
continue
211211
}
212212

0 commit comments

Comments
 (0)