Skip to content
This repository was archived by the owner on Jun 16, 2022. It is now read-only.

Commit 0506777

Browse files
authored
Apply stashed changes
1 parent 8b2cdeb commit 0506777

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

dist/index.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
6565
function 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+
}
9396
detect();
9497

9598

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const detector = {
2424
// dependencies (i.e. which dependencies depend on which)
2525
// eslint-disable-next-line quotes
2626
// eslint-disable-next-line no-useless-escape
27-
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}}\''
27+
const goListDependencies =
28+
'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}}"'
2829

2930
// Enumerate directories
3031
async function detect () {
@@ -48,7 +49,10 @@ async function detect () {
4849
}
4950

5051
const metadataInput = core.getInput('metadata')
52+
go(goModDir, goBuildTarget, metadataInput)
53+
}
5154

55+
function go (goModDir: string, goBuildTarget: string, metadataInput?: string) {
5256
process.chdir(goModDir)
5357
console.log(
5458
`Running go package detection in ${process.cwd()} on build target ${goBuildTarget}`

0 commit comments

Comments
 (0)