Skip to content

Commit c9d6c80

Browse files
committed
Log when vendor dir extraction is active
1 parent 684aedf commit c9d6c80

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

go/extractor/extractor.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,23 @@ 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 := util.IsVendorDirExtractionEnabled()
87+
88+
modeNotifications := make([]string, 0, 2)
8589
if extractTests {
86-
testMessage = " (test extraction enabled)"
90+
modeNotifications = append(modeNotifications, "test extraction enabled")
91+
}
92+
if includeVendor {
93+
modeNotifications = append(modeNotifications, "extracting vendor directories")
8794
}
88-
log.Printf("Running packages.Load%s.", testMessage)
95+
96+
modeMessage := strings.Join(modeNotifications, ", ")
97+
if modeMessage != "" {
98+
modeMessage = " (" + modeMessage + ")"
99+
}
100+
log.Printf("Running packages.Load%s.", modeMessage)
89101

90102
// This includes test packages if either we're tracing a `go test` command,
91103
// or if CODEQL_EXTRACTOR_GO_OPTION_EXTRACT_TESTS is set to "true".
@@ -233,9 +245,6 @@ func ExtractWithFlags(buildFlags []string, patterns []string, extractTests bool)
233245
// Construct a list of directory segments to exclude from extraction, starting with ".."
234246
excludedDirs := []string{`\.\.`}
235247

236-
// If CODEQL_EXTRACTOR_GO_[OPTION_]EXTRACT_VENDOR_DIRS is "true", we extract `vendor` directories;
237-
// otherwise (the default) is to exclude them from extraction
238-
includeVendor := util.IsVendorDirExtractionEnabled()
239248
if !includeVendor {
240249
excludedDirs = append(excludedDirs, "vendor")
241250
}

0 commit comments

Comments
 (0)