@@ -60,7 +60,7 @@ const detector = {
6060// dependencies (i.e. which dependencies depend on which)
6161// eslint-disable-next-line quotes
6262// eslint-disable-next-line no-useless-escape
63- const goListDependencies = ` go list -deps -f ' {{define \"M\\"}}{{.Path}}@{{.Version}}{{end}}{{with .Module}}{{if not .Main}}{{if .Replace}}{{template \\"M\\" .Replace}}{{else}}{{template \\"M\\" .}}{{end}}{{end}}{{end}}'` ;
63+ const goListDependencies = ' go list -deps -f " {{define \\ "M\\"}}{{.Path}}@{{.Version}}{{end}}{{with .Module}}{{if not .Main}}{{if .Replace}}{{template \\"M\\" .Replace}}{{else}}{{template \\"M\\" .}}{{end}}{{end}}{{end}}"' ;
6464// Enumerate directories
6565function detect() {
6666 return __awaiter(this, void 0, void 0, function* () {
@@ -80,16 +80,19 @@ function detect() {
8080 }
8181 }
8282 const metadataInput = core.getInput('metadata');
83- process.chdir(goModDir);
84- console.log(`Running go package detection in ${process.cwd()} on build target ${goBuildTarget}`);
85- const options = { detector };
86- if (metadataInput) {
87- const metadata = JSON.parse(metadataInput);
88- options.metadata = metadata;
89- }
90- (0, dependency_submission_toolkit_1.run)(parseDependentsFunc, { command: `${goListDependencies} ${goBuildTarget}` }, options);
83+ go(goModDir, goBuildTarget, metadataInput);
9184 });
9285}
86+ function go(goModDir, goBuildTarget, metadataInput) {
87+ process.chdir(goModDir);
88+ console.log(`Running go package detection in ${process.cwd()} on build target ${goBuildTarget}`);
89+ const options = { detector };
90+ if (metadataInput) {
91+ const metadata = JSON.parse(metadataInput);
92+ options.metadata = metadata;
93+ }
94+ (0, dependency_submission_toolkit_1.run)(parseDependentsFunc, { command: `${goListDependencies} ${goBuildTarget}` }, options);
95+ }
9396detect();
9497
9598
0 commit comments