Skip to content

Commit 7aadebe

Browse files
authored
fix: correct go path for commands executed in method getFinalPackagesVersionsForModule (#225)
## Description fix: correct go path for commands executed in method getFinalPackagesVersionsForModule This happens because [`getFinalPackagesVersionsForModule`](https://github.com/guacsec/trustify-da-java-client/blob/v0.0.10/src/main/java/io/github/guacsec/trustifyda/providers/GoModulesProvider.java#L319-L323) doesn't use the resolved go executable path. This is uncovered by #188 which set the use of the MVS algorithm default to true and trigger the `getFinalPackagesVersionsForModule` method by default. **Related issue (if any):** fixes #224 ## Checklist - [x] I have followed this repository's contributing guidelines. - [x] I will adhere to the project's code of conduct.
1 parent 1cd01c2 commit 7aadebe

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/io/github/guacsec/trustifyda/providers/GoModulesProvider.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ private Sbom buildSbomFromGraph(
318318

319319
private Map<String, List<String>> getFinalPackagesVersionsForModule(
320320
Map<String, List<String>> edges, Path manifestPath) {
321-
Operations.runProcessGetOutput(manifestPath.getParent(), "go", "mod", "download");
321+
Operations.runProcessGetOutput(manifestPath.getParent(), goExecutable, "mod", "download");
322322
String finalVersionsForAllModules =
323-
Operations.runProcessGetOutput(manifestPath.getParent(), "go", "list", "-m", "all");
323+
Operations.runProcessGetOutput(manifestPath.getParent(), goExecutable, "list", "-m", "all");
324324
Map<String, String> finalModulesVersions =
325325
Arrays.stream(finalVersionsForAllModules.split(Operations.GENERIC_LINE_SEPARATOR))
326326
.filter(string -> string.trim().split(" ").length == 2)
@@ -395,8 +395,7 @@ private static boolean isGoToolchainEntry(String dependency) {
395395
}
396396

397397
private String buildGoModulesDependencies(Path manifestPath) {
398-
String[] goModulesDeps;
399-
goModulesDeps = new String[] {goExecutable, "mod", "graph"};
398+
String[] goModulesDeps = new String[] {goExecutable, "mod", "graph"};
400399

401400
// execute the clean command
402401
String goModulesOutput =

0 commit comments

Comments
 (0)