Skip to content

Commit

Permalink
depguard: reduce requirements (#2672)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored Mar 21, 2022
1 parent f055441 commit 8f7f44d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/golinters/depguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewDepguard() *goanalysis.Linter {
}
}).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}).WithLoadMode(goanalysis.LoadModeSyntax)
}

type depGuard struct {
Expand Down
9 changes: 7 additions & 2 deletions pkg/golinters/goanalysis/adapters.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
)

func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
var info types.Info
if pass.TypesInfo != nil {
info = *pass.TypesInfo
}

prog := &loader.Program{
Fset: pass.Fset,
Created: []*loader.PackageInfo{
Expand All @@ -18,7 +23,7 @@ func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {

Files: pass.Files,
Errors: nil,
Info: *pass.TypesInfo,
Info: info,
},
},
AllPackages: map[*types.Package]*loader.PackageInfo{
Expand All @@ -28,7 +33,7 @@ func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program {
TransitivelyErrorFree: true,
Files: pass.Files,
Errors: nil,
Info: *pass.TypesInfo,
Info: info,
},
},
}
Expand Down
1 change: 0 additions & 1 deletion pkg/lint/lintersdb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {

linter.NewConfig(golinters.NewDepguard()).
WithSince("v1.4.0").
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule).
WithURL("https://github.com/OpenPeeDeeP/depguard"),

Expand Down

0 comments on commit 8f7f44d

Please sign in to comment.