Skip to content

Commit 8f7f44d

Browse files
authored
depguard: reduce requirements (#2672)
1 parent f055441 commit 8f7f44d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

pkg/golinters/depguard.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func NewDepguard() *goanalysis.Linter {
5151
}
5252
}).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
5353
return resIssues
54-
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
54+
}).WithLoadMode(goanalysis.LoadModeSyntax)
5555
}
5656

5757
type depGuard struct {

pkg/golinters/goanalysis/adapters.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import (
88
)
99

1010
func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
11+
var info types.Info
12+
if pass.TypesInfo != nil {
13+
info = *pass.TypesInfo
14+
}
15+
1116
prog := &loader.Program{
1217
Fset: pass.Fset,
1318
Created: []*loader.PackageInfo{
@@ -18,7 +23,7 @@ func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
1823

1924
Files: pass.Files,
2025
Errors: nil,
21-
Info: *pass.TypesInfo,
26+
Info: info,
2227
},
2328
},
2429
AllPackages: map[*types.Package]*loader.PackageInfo{
@@ -28,7 +33,7 @@ func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
2833
TransitivelyErrorFree: true,
2934
Files: pass.Files,
3035
Errors: nil,
31-
Info: *pass.TypesInfo,
36+
Info: info,
3237
},
3338
},
3439
}

pkg/lint/lintersdb/manager.go

-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
219219

220220
linter.NewConfig(golinters.NewDepguard()).
221221
WithSince("v1.4.0").
222-
WithLoadForGoAnalysis().
223222
WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule).
224223
WithURL("https://github.com/OpenPeeDeeP/depguard"),
225224

0 commit comments

Comments
 (0)