Skip to content

Commit be52150

Browse files
committed
Go: Do not add dummy files to CompilationCompilingFilesTable
1 parent 5e08bf0 commit be52150

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

go/extractor/extractor.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ func (extraction *Extraction) extractError(tw *trap.Writer, err packages.Error,
551551
log.Printf("Warning: failed to evaluate symlinks for %s", wd)
552552
}
553553
file = filepath.Join(ewd, "-")
554-
extraction.extractFileInfo(tw, file)
554+
extraction.extractFileInfo(tw, file, true)
555555
} else {
556556
var rawfile string
557557
if parts := threePartPos.FindStringSubmatch(pos); parts != nil {
@@ -586,7 +586,7 @@ func (extraction *Extraction) extractError(tw *trap.Writer, err packages.Error,
586586
file = afile
587587
}
588588

589-
extraction.extractFileInfo(tw, file)
589+
extraction.extractFileInfo(tw, file, false)
590590
}
591591

592592
extraction.Lock.Lock()
@@ -655,7 +655,7 @@ func (extraction *Extraction) extractFile(ast *ast.File, pkg *packages.Package)
655655
return err
656656
}
657657

658-
extraction.extractFileInfo(tw, path)
658+
extraction.extractFileInfo(tw, path, false)
659659

660660
extractScopes(tw, ast, pkg)
661661

@@ -673,7 +673,7 @@ func (extraction *Extraction) extractFile(ast *ast.File, pkg *packages.Package)
673673

674674
// extractFileInfo extracts file-system level information for the given file, populating
675675
// the `files` and `containerparent` tables
676-
func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string) {
676+
func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDummy bool) {
677677
// We may visit the same file twice because `extractError` calls this function to describe files containing
678678
// compilation errors. It is also called for user source files being extracted.
679679
extraction.Lock.Lock()
@@ -705,7 +705,9 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string) {
705705
dbscheme.HasLocationTable.Emit(tw, lbl, emitLocation(tw, lbl, 0, 0, 0, 0))
706706
extraction.Lock.Lock()
707707
slbl := extraction.StatWriter.Labeler.FileLabelFor(file)
708-
dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl)
708+
if !isDummy {
709+
dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl)
710+
}
709711
extraction.Lock.Unlock()
710712
break
711713
}

go/extractor/gomodextractor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (extraction *Extraction) extractGoMod(path string) error {
4040
return err
4141
}
4242

43-
extraction.extractFileInfo(tw, path)
43+
extraction.extractFileInfo(tw, path, false)
4444

4545
file, err := os.Open(path)
4646
if err != nil {

0 commit comments

Comments
 (0)