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

Commit ad214b8

Browse files
authored
commit dist
1 parent f1fbcc4 commit ad214b8

File tree

4 files changed

+37
-46
lines changed

4 files changed

+37
-46
lines changed

dist/go_mod_parser.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

dist/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ function detect() {
7474
if (!fs_1.default.existsSync(goBuildTarget)) {
7575
throw new Error(`The build target '${goBuildTarget}' does not exist`);
7676
}
77-
if (goModDir !== "." && !goBuildTarget.startsWith(goModDir)) {
77+
if (goModDir !== '.' && !goBuildTarget.startsWith(goModDir)) {
7878
throw new Error(`The build target ${goBuildTarget} is not a sub-directory of ${goModDir}`);
7979
}
8080
}
8181
const metadataInput = core.getInput('metadata');
82-
process.chdir(goModPath);
82+
process.chdir(goModDir);
8383
console.log(`Running go package detection in ${path} on build target ${goBuildTarget}`);
8484
const options = { detector };
8585
if (metadataInput) {
@@ -110,7 +110,10 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
110110
// format "${GO_PACKAGE}@v{VERSION}"
111111
function parseDependents(contents) {
112112
// split the input by newlines, sort, and dedup
113-
const packages = Array.from(new Set(contents.split('\n').map(p => p.trim()).sort()));
113+
const packages = Array.from(new Set(contents
114+
.split('\n')
115+
.map((p) => p.trim())
116+
.sort()));
114117
const entries = {};
115118
packages.forEach((pkg) => {
116119
if (!pkg)

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.

dist/parse-go-package.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.parseDependents = void 0;
7+
const processor_1 = require("@github/dependency-submission-toolkit/dist/processor");
8+
const path_1 = __importDefault(require("path"));
9+
// processes a list of go dependencies, one dependency per line, matching the
10+
// format "${GO_PACKAGE}@v{VERSION}"
11+
function parseDependents(contents) {
12+
// split the input by newlines, sort, and dedup
13+
const packages = Array.from(new Set(contents
14+
.split('\n')
15+
.map((p) => p.trim())
16+
.sort()));
17+
const entries = {};
18+
packages.forEach((pkg) => {
19+
if (!pkg)
20+
return;
21+
const [qualifiedPackage, version] = pkg.split('@');
22+
// URI-encode slashes in the namespace
23+
const namespace = encodeURIComponent(path_1.default.dirname(qualifiedPackage));
24+
const name = path_1.default.basename(qualifiedPackage);
25+
const targetPkg = `pkg:golang/${namespace}/${name}@${version}`;
26+
entries[targetPkg] = new processor_1.Entry(targetPkg);
27+
});
28+
return entries;
29+
}
30+
exports.parseDependents = parseDependents;

0 commit comments

Comments
 (0)