File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 6
6
"os"
7
7
"path"
8
8
"path/filepath"
9
+
10
+ "github.com/github/codeql-go/extractor/util"
9
11
)
10
12
11
13
func fileExists (path string ) bool {
@@ -26,7 +28,7 @@ type BaselineConfig struct {
26
28
func GetConfigBaselineAsJSON (rootDir string ) ([]byte , error ) {
27
29
vendorDirs := make ([]string , 0 )
28
30
29
- if os . Getenv ( "CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS" ) == "true" {
31
+ if util . IsVendorDirExtractionEnabled () {
30
32
// The user wants vendor directories scanned; emit an empty report.
31
33
} else {
32
34
filepath .WalkDir (rootDir , func (dirPath string , d fs.DirEntry , err error ) error {
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ func ExtractWithFlags(buildFlags []string, patterns []string) error {
199
199
200
200
// If CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS is "true", we extract `vendor` directories;
201
201
// otherwise (the default) is to exclude them from extraction
202
- includeVendor := os . Getenv ( "CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS" ) == "true"
202
+ includeVendor := util . IsVendorDirExtractionEnabled ()
203
203
if ! includeVendor {
204
204
excludedDirs = append (excludedDirs , "vendor" )
205
205
}
Original file line number Diff line number Diff line change
1
+ package util
2
+
3
+ import (
4
+ "os"
5
+ )
6
+
7
+ func IsVendorDirExtractionEnabled () bool {
8
+ return os .Getenv ("CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS" ) == "true"
9
+ }
You can’t perform that action at this time.
0 commit comments