Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
public string GoModPathAndVersion { get; set; }

public string GoModReplacement { get; set; }

public string ExceptionMessage { get; set; }

Check warning on line 11 in src/Microsoft.ComponentDetection.Common/Telemetry/Records/GoReplaceTelemetryRecord.cs

View check run for this annotation

Codecov / codecov/patch

src/Microsoft.ComponentDetection.Common/Telemetry/Records/GoReplaceTelemetryRecord.cs#L11

Added line #L11 was not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,19 @@
if (dependency.Replace?.Path != null && dependency.Replace.Version != null)
{
var dependencyReplacementName = $"{dependency.Replace.Path} {dependency.Replace.Version}";
goComponent = new GoComponent(dependency.Replace.Path, dependency.Replace.Version);
this.Logger.LogInformation("go Module {GoModule} being replaced with module {GoModuleReplacement}", dependencyName, dependencyReplacementName);
record.GoModPathAndVersion = dependencyName;
record.GoModReplacement = dependencyReplacementName;
try
{
goComponent = new GoComponent(dependency.Replace.Path, dependency.Replace.Version);
this.Logger.LogInformation("go Module {GoModule} being replaced with module {GoModuleReplacement}", dependencyName, dependencyReplacementName);
}
catch (Exception ex)
{
record.ExceptionMessage = ex.Message;
this.Logger.LogWarning("tried to use replace module {GoModuleReplacement} but got this error {ErrorMessage} using original module {GoModule} instead", dependencyReplacementName, ex.Message, dependencyName);
goComponent = new GoComponent(dependency.Path, dependency.Version);
}

Check warning on line 492 in src/Microsoft.ComponentDetection.Detectors/go/GoComponentDetector.cs

View check run for this annotation

Codecov / codecov/patch

src/Microsoft.ComponentDetection.Detectors/go/GoComponentDetector.cs#L487-L492

Added lines #L487 - L492 were not covered by tests
}
else
{
Expand Down
Loading