File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,16 @@ import (
33
33
"golang.org/x/tools/go/packages"
34
34
)
35
35
36
+ // LoadMode controls the amount of details to return when loading the packages
37
+ const LoadMode = packages .NeedName |
38
+ packages .NeedFiles |
39
+ packages .NeedCompiledGoFiles |
40
+ packages .NeedImports |
41
+ packages .NeedTypes |
42
+ packages .NeedTypesSizes |
43
+ packages .NeedTypesInfo |
44
+ packages .NeedSyntax
45
+
36
46
// The Context is populated with data parsed from the source code as it is scanned.
37
47
// It is passed through to all rule functions as they are called. Rules may use
38
48
// this data in conjunction withe the encountered AST node.
@@ -140,7 +150,7 @@ func (gosec *Analyzer) pkgConfig(buildTags []string) *packages.Config {
140
150
flags = append (flags , tagsFlag )
141
151
}
142
152
return & packages.Config {
143
- Mode : packages . LoadSyntax ,
153
+ Mode : LoadMode ,
144
154
BuildFlags : flags ,
145
155
Tests : gosec .tests ,
146
156
}
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ func (p *TestPackage) Build() error {
80
80
}
81
81
82
82
conf := & packages.Config {
83
- Mode : packages . LoadSyntax ,
83
+ Mode : gosec . LoadMode ,
84
84
Tests : false ,
85
85
}
86
86
pkgs , err := packages .Load (conf , packageFiles ... )
You can’t perform that action at this time.
0 commit comments