From 59ac2d3d3e18ed34a34291cb00e6d475aa14dc5f Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Fri, 14 Nov 2025 10:24:22 +0000 Subject: [PATCH] Move `TransformPath` into `FileLabelFor` This way we don't have to remember to transform it at all call sites. --- go/extractor/extractor.go | 4 ++-- go/extractor/trap/labels.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go/extractor/extractor.go b/go/extractor/extractor.go index 09dd1b3f5750..314fb8a56c13 100644 --- a/go/extractor/extractor.go +++ b/go/extractor/extractor.go @@ -815,12 +815,12 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu displayPath = rawPath } if i == len(components)-1 { - lbl := tw.Labeler.FileLabelFor(path) + lbl := tw.Labeler.FileLabelFor(file) dbscheme.FilesTable.Emit(tw, lbl, displayPath) dbscheme.ContainerParentTable.Emit(tw, parentLbl, lbl) dbscheme.HasLocationTable.Emit(tw, lbl, emitLocation(tw, lbl, 0, 0, 0, 0)) extraction.Lock.Lock() - slbl := extraction.StatWriter.Labeler.FileLabelFor(path) + slbl := extraction.StatWriter.Labeler.FileLabelFor(file) if !isDummy { dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl) } diff --git a/go/extractor/trap/labels.go b/go/extractor/trap/labels.go index 3fc02d066cfc..473e2e761f2e 100644 --- a/go/extractor/trap/labels.go +++ b/go/extractor/trap/labels.go @@ -69,14 +69,14 @@ func (l *Labeler) GlobalID(key string) Label { // FileLabel returns the label for a file with path `path`. func (l *Labeler) FileLabel() Label { if l.fileLabel == InvalidLabel { - l.fileLabel = l.FileLabelFor(srcarchive.TransformPath(l.tw.path)) + l.fileLabel = l.FileLabelFor(l.tw.path) } return l.fileLabel } // 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(filepath.ToSlash(path)) + ";sourcefile") + return l.GlobalID(util.EscapeTrapSpecialChars(filepath.ToSlash(srcarchive.TransformPath(path))) + ";sourcefile") } // LocalID associates a label with the given AST node `nd` and returns it