Skip to content

Commit 2939cef

Browse files
committed
Use platform path separators for file testing, and forward-slashes for reporting to CodeQL
1 parent c99a846 commit 2939cef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

go/extractor/configurebaseline/configurebaseline.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func fileExists(path string) bool {
1818
// Decides if `dirPath` is a vendor directory by testing whether it is called `vendor`
1919
// and contains a `modules.txt` file.
2020
func isGolangVendorDirectory(dirPath string) bool {
21-
return path.Base(dirPath) == "vendor" && fileExists(path.Join(dirPath, "modules.txt"))
21+
return filepath.Base(dirPath) == "vendor" && fileExists(filepath.Join(dirPath, "modules.txt"))
2222
}
2323

2424
type BaselineConfig struct {
@@ -38,7 +38,8 @@ func GetConfigBaselineAsJSON(rootDir string) ([]byte, error) {
3838
return nil
3939
}
4040
if isGolangVendorDirectory(dirPath) {
41-
vendorDirs = append(vendorDirs, path.Join(dirPath, "**"))
41+
// Note that CodeQL expects a forward-slash-separated path, even on Windows.
42+
vendorDirs = append(vendorDirs, path.Join(filepath.ToSlash(dirPath), "**"))
4243
return filepath.SkipDir
4344
} else {
4445
return nil

0 commit comments

Comments
 (0)