@@ -81,11 +81,27 @@ func ExtractWithFlags(buildFlags []string, patterns []string, extractTests bool)
8181 }
8282 }
8383
84- testMessage := ""
84+ // If CODEQL_EXTRACTOR_GO_[OPTION_]EXTRACT_VENDOR_DIRS is "true", we extract `vendor` directories;
85+ // otherwise (the default) is to exclude them from extraction
86+ includeVendor , oldOptionUsed := util .IsVendorDirExtractionEnabled ()
87+
88+ if oldOptionUsed {
89+ log .Println ("Warning: obsolete option \" CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS\" was set. Use \" CODEQL_EXTRACTOR_GO_OPTION_EXTRACT_VENDOR_DIRS\" or pass `--extractor-option extract_vendor_dirs=true` instead." )
90+ }
91+
92+ modeNotifications := make ([]string , 0 , 2 )
8593 if extractTests {
86- testMessage = " ( test extraction enabled)"
94+ modeNotifications = append ( modeNotifications , " test extraction enabled" )
8795 }
88- log .Printf ("Running packages.Load%s." , testMessage )
96+ if includeVendor {
97+ modeNotifications = append (modeNotifications , "extracting vendor directories" )
98+ }
99+
100+ modeMessage := strings .Join (modeNotifications , ", " )
101+ if modeMessage != "" {
102+ modeMessage = " (" + modeMessage + ")"
103+ }
104+ log .Printf ("Running packages.Load%s." , modeMessage )
89105
90106 // This includes test packages if either we're tracing a `go test` command,
91107 // or if CODEQL_EXTRACTOR_GO_OPTION_EXTRACT_TESTS is set to "true".
@@ -233,9 +249,6 @@ func ExtractWithFlags(buildFlags []string, patterns []string, extractTests bool)
233249 // Construct a list of directory segments to exclude from extraction, starting with ".."
234250 excludedDirs := []string {`\.\.` }
235251
236- // If CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS is "true", we extract `vendor` directories;
237- // otherwise (the default) is to exclude them from extraction
238- includeVendor := util .IsVendorDirExtractionEnabled ()
239252 if ! includeVendor {
240253 excludedDirs = append (excludedDirs , "vendor" )
241254 }
0 commit comments