5252public final class GoModulesProvider extends Provider {
5353
5454 public static final String PROP_EXHORT_GO_MVS_LOGIC_ENABLED = "EXHORT_GO_MVS_LOGIC_ENABLED" ;
55+ private static final String GO_BINARY = Operations .isWindows () ? "go.cmd" : "go" ;
5556 private static final Logger log = LoggersFactory .getLogger (GoModulesProvider .class .getName ());
5657 private static final String GO_HOST_ARCHITECTURE_ENV_NAME = "GOHOSTARCH" ;
5758 private static final String GO_HOST_OPERATION_SYSTEM_ENV_NAME = "GOHOSTOS" ;
@@ -67,7 +68,7 @@ public String getMainModuleVersion() {
6768
6869 public GoModulesProvider (Path manifest ) {
6970 super (Type .GOLANG , manifest );
70- this .goExecutable = Operations .getExecutable ("go" , "version" );
71+ this .goExecutable = Operations .getExecutable (GO_BINARY , "version" );
7172 this .goEnvironmentVariableForPurl = getQualifiers (true );
7273 this .mainModuleVersion = getDefaultMainModuleVersion ();
7374 }
@@ -320,9 +321,9 @@ private Sbom buildSbomFromGraph(
320321
321322 private Map <String , List <String >> getFinalPackagesVersionsForModule (
322323 Map <String , List <String >> edges , Path manifestPath ) {
323- Operations .runProcessGetOutput (manifestPath .getParent (), "go" , "mod" , "download" );
324+ Operations .runProcessGetOutput (manifestPath .getParent (), GO_BINARY , "mod" , "download" );
324325 String finalVersionsForAllModules =
325- Operations .runProcessGetOutput (manifestPath .getParent (), "go" , "list" , "-m" , "all" );
326+ Operations .runProcessGetOutput (manifestPath .getParent (), GO_BINARY , "list" , "-m" , "all" );
326327 Map <String , String > finalModulesVersions =
327328 Arrays .stream (finalVersionsForAllModules .split (System .lineSeparator ()))
328329 .filter (string -> string .trim ().split (" " ).length == 2 )
0 commit comments