Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depguard: reduce requirements #2672

Merged
merged 1 commit into from Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/golinters/depguard.go
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
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
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