Skip to content

Commit b4b30b7

Browse files
committed
Go: apply path transformer for file TRAP labels
1 parent 87d001f commit b4b30b7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

go/extractor/extractor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,12 +814,12 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
814814
displayPath = rawPath
815815
}
816816
if i == len(components)-1 {
817-
lbl := tw.Labeler.FileLabelFor(file)
817+
lbl := tw.Labeler.FileLabelFor(path)
818818
dbscheme.FilesTable.Emit(tw, lbl, displayPath)
819819
dbscheme.ContainerParentTable.Emit(tw, parentLbl, lbl)
820820
dbscheme.HasLocationTable.Emit(tw, lbl, emitLocation(tw, lbl, 0, 0, 0, 0))
821821
extraction.Lock.Lock()
822-
slbl := extraction.StatWriter.Labeler.FileLabelFor(file)
822+
slbl := extraction.StatWriter.Labeler.FileLabelFor(path)
823823
if !isDummy {
824824
dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl)
825825
}

go/extractor/trap/labels.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"go/types"
66

7+
"github.com/github/codeql-go/extractor/srcarchive"
78
"github.com/github/codeql-go/extractor/util"
89
)
910

@@ -67,7 +68,7 @@ func (l *Labeler) GlobalID(key string) Label {
6768
// FileLabel returns the label for a file with path `path`.
6869
func (l *Labeler) FileLabel() Label {
6970
if l.fileLabel == InvalidLabel {
70-
l.fileLabel = l.FileLabelFor(l.tw.path)
71+
l.fileLabel = l.FileLabelFor(srcarchive.TransformPath(l.tw.path))
7172
}
7273
return l.fileLabel
7374
}

0 commit comments

Comments
 (0)