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 66 "os"
77 "path"
88 "path/filepath"
9+
10+ "github.com/github/codeql-go/extractor/util"
911)
1012
1113func fileExists (path string ) bool {
@@ -26,7 +28,7 @@ type BaselineConfig struct {
2628func GetConfigBaselineAsJSON (rootDir string ) ([]byte , error ) {
2729 vendorDirs := make ([]string , 0 )
2830
29- if os . Getenv ( "CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS" ) == "true" {
31+ if util . IsVendorDirExtractionEnabled () {
3032 // The user wants vendor directories scanned; emit an empty report.
3133 } else {
3234 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 {
199199
200200 // If CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS is "true", we extract `vendor` directories;
201201 // otherwise (the default) is to exclude them from extraction
202- includeVendor := os . Getenv ( "CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS" ) == "true"
202+ includeVendor := util . IsVendorDirExtractionEnabled ()
203203 if ! includeVendor {
204204 excludedDirs = append (excludedDirs , "vendor" )
205205 }
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