From 10fa1d650df26c5927112502aae4e4e8d7c31080 Mon Sep 17 00:00:00 2001 From: Nick Rolfe Date: Thu, 23 Oct 2025 15:56:59 +0100 Subject: [PATCH] Go: be consistent in replacement of backslashes in file labels --- go/extractor/trap/labels.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/extractor/trap/labels.go b/go/extractor/trap/labels.go index 9a03bfe9a57..3fc02d066cf 100644 --- a/go/extractor/trap/labels.go +++ b/go/extractor/trap/labels.go @@ -3,6 +3,7 @@ package trap import ( "fmt" "go/types" + "path/filepath" "github.com/github/codeql-go/extractor/srcarchive" "github.com/github/codeql-go/extractor/util" @@ -75,7 +76,7 @@ func (l *Labeler) FileLabel() Label { // FileLabelFor returns the label for the file for which the trap writer `tw` is associated func (l *Labeler) FileLabelFor(path string) Label { - return l.GlobalID(util.EscapeTrapSpecialChars(path) + ";sourcefile") + return l.GlobalID(util.EscapeTrapSpecialChars(filepath.ToSlash(path)) + ";sourcefile") } // LocalID associates a label with the given AST node `nd` and returns it