component-detection icon indicating copy to clipboard operation
component-detection copied to clipboard

Go/GoWithReplace skipping over go.mod files in child directories

Open FernandoRojo opened this issue 1 year ago • 0 comments

If you have a file structure like this:

/
- Path1/
- - go.mod
- - go.sum
- - ...
- Path2/
- - go.mod
- - go.sum
- - ...
- go.mod
- go.sum

The internal go.mod files are skipped due to these lines: https://github.com/microsoft/component-detection/blob/80146ce1b940c4075156165f6d677b68d7e368f7/src/Microsoft.ComponentDetection.Detectors/go/GoComponentDetector.cs#L157

if (this.projectRoots.Any(path => projectRootDirectory.FullName.StartsWith(path)))
        {
            return;
        }

We would expect the root go.mod to have all the internal references, but in cases where the internal directories are not referenced by the root mod then components are being skipped.

FernandoRojo avatar Aug 02 '24 22:08 FernandoRojo