snyk-go-plugin
Advanced tools
Comparing version 1.20.0 to 1.21.0
@@ -102,4 +102,5 @@ "use strict"; | ||
if (packageManager === 'gomodules') { | ||
const dependencyGraph = await buildDepGraphFromImportsAndModules(root, targetFile, additionalArgs); | ||
return { | ||
dependencyGraph: await buildDepGraphFromImportsAndModules(root, targetFile, additionalArgs), | ||
dependencyGraph, | ||
}; | ||
@@ -380,6 +381,7 @@ } | ||
} | ||
function buildGraph(depGraphBuilder, depPackages, packagesByName, currentParent, childrenChain, ancestorsChain) { | ||
function buildGraph(depGraphBuilder, depPackages, packagesByName, currentParent, childrenChain, ancestorsChain, visited) { | ||
var _a; | ||
const depPackagesLen = depPackages.length; | ||
for (let i = depPackagesLen - 1; i >= 0; i--) { | ||
visited = visited || new Set(); | ||
const packageImport = depPackages[i]; | ||
@@ -413,4 +415,13 @@ let version = 'unknown'; | ||
} | ||
if (visited.has(packageImport)) { | ||
const prunedId = `${packageImport}:pruned`; | ||
depGraphBuilder.addPkgNode(newNode, prunedId, { | ||
labels: { pruned: 'true' }, | ||
}); | ||
depGraphBuilder.connectDep(currentParent, prunedId); | ||
continue; | ||
} | ||
depGraphBuilder.addPkgNode(newNode, packageImport); | ||
depGraphBuilder.connectDep(currentParent, packageImport); | ||
visited.add(packageImport); | ||
childrenChain.set(currentParent, [...currentChildren, packageImport]); | ||
@@ -420,3 +431,3 @@ ancestorsChain.set(packageImport, [...currentAncestors, currentParent]); | ||
if (transitives.length > 0) { | ||
buildGraph(depGraphBuilder, transitives, packagesByName, packageImport, childrenChain, ancestorsChain); | ||
buildGraph(depGraphBuilder, transitives, packagesByName, packageImport, childrenChain, ancestorsChain, visited); | ||
} | ||
@@ -423,0 +434,0 @@ } |
@@ -156,8 +156,9 @@ import * as fs from 'fs'; | ||
if (packageManager === 'gomodules') { | ||
const dependencyGraph = await buildDepGraphFromImportsAndModules( | ||
root, | ||
targetFile, | ||
additionalArgs, | ||
); | ||
return { | ||
dependencyGraph: await buildDepGraphFromImportsAndModules( | ||
root, | ||
targetFile, | ||
additionalArgs, | ||
), | ||
dependencyGraph, | ||
}; | ||
@@ -601,2 +602,3 @@ } | ||
ancestorsChain: Map<string, string[]>, | ||
visited?: Set<string>, | ||
) { | ||
@@ -606,2 +608,3 @@ const depPackagesLen = depPackages.length; | ||
for (let i = depPackagesLen - 1; i >= 0; i--) { | ||
visited = visited || new Set<string>(); | ||
const packageImport = depPackages[i]; | ||
@@ -642,4 +645,14 @@ let version = 'unknown'; | ||
if (visited.has(packageImport)) { | ||
const prunedId = `${packageImport}:pruned`; | ||
depGraphBuilder.addPkgNode(newNode, prunedId, { | ||
labels: { pruned: 'true' }, | ||
}); | ||
depGraphBuilder.connectDep(currentParent, prunedId); | ||
continue; | ||
} | ||
depGraphBuilder.addPkgNode(newNode, packageImport); | ||
depGraphBuilder.connectDep(currentParent, packageImport); | ||
visited.add(packageImport); | ||
@@ -658,2 +671,3 @@ childrenChain.set(currentParent, [...currentChildren, packageImport]); | ||
ancestorsChain, | ||
visited, | ||
); | ||
@@ -660,0 +674,0 @@ } |
@@ -51,3 +51,3 @@ { | ||
}, | ||
"version": "1.20.0" | ||
"version": "1.21.0" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92574
1322