New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

snyk-go-parser

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-go-parser - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

4

dist/index.js

@@ -16,3 +16,3 @@ "use strict";

async function buildGoPkgDepTree(manifestFileContents, lockFileContents, options) {
return buildGoDepTree(parsers_1.parseGoPkgConfig(manifestFileContents, lockFileContents));
return buildGoDepTree(await parsers_1.parseGoPkgConfig(manifestFileContents, lockFileContents));
}

@@ -24,3 +24,3 @@ exports.buildGoPkgDepTree = buildGoPkgDepTree;

async function buildGoVendorDepTree(manifestFileContents) {
return buildGoDepTree(parsers_1.parseGoVendorConfig(manifestFileContents));
return buildGoDepTree(await parsers_1.parseGoVendorConfig(manifestFileContents));
}

@@ -27,0 +27,0 @@ exports.buildGoVendorDepTree = buildGoVendorDepTree;

import { GoPackageConfig } from '../types';
export declare function parseGoPkgConfig(manifestFileContents: string, lockFileContents: string): GoPackageConfig;
export declare function parseGoPkgConfig(manifestFileContents: string, lockFileContents: string): Promise<GoPackageConfig>;

@@ -6,3 +6,4 @@ "use strict";

const errors_1 = require("../errors");
function parseDepLockContents(lockFileString) {
const event_loop_spinner_1 = require("event-loop-spinner");
async function parseDepLockContents(lockFileString) {
try {

@@ -12,5 +13,5 @@ const lockJson = toml.parse(lockFileString);

if (lockJson.projects) {
lockJson.projects.forEach((proj) => {
for (const proj of lockJson.projects) {
const version = proj.version || '#' + proj.revision;
proj.packages.forEach((subpackageName) => {
for (const subpackageName of proj.packages) {
const name = subpackageName === '.'

@@ -24,4 +25,7 @@ ? proj.name

deps[dep.name] = dep;
});
});
if (event_loop_spinner_1.eventLoopSpinner.isStarving()) {
await event_loop_spinner_1.eventLoopSpinner.spin();
}
}
}
}

@@ -44,3 +48,3 @@ return deps;

}
function parseGoPkgConfig(manifestFileContents, lockFileContents) {
async function parseGoPkgConfig(manifestFileContents, lockFileContents) {
if (!manifestFileContents && !lockFileContents) {

@@ -52,3 +56,3 @@ throw new errors_1.InvalidUserInputError('Gopkg.lock and Gopkg.toml file contents are empty');

}
const lockedVersions = parseDepLockContents(lockFileContents);
const lockedVersions = await parseDepLockContents(lockFileContents);
let ignoredPkgs = [];

@@ -55,0 +59,0 @@ if (manifestFileContents) {

import { GoPackageConfig } from '../types';
export declare function parseGoVendorConfig(manifestFileContents: string): GoPackageConfig;
export declare function parseGoVendorConfig(manifestFileContents: string): Promise<GoPackageConfig>;

@@ -5,3 +5,4 @@ "use strict";

const errors_1 = require("../errors");
function parseGovendorJsonContents(jsonStr) {
const event_loop_spinner_1 = require("event-loop-spinner");
async function parseGovendorJsonContents(jsonStr) {
try {

@@ -16,3 +17,3 @@ const gvJson = JSON.parse(jsonStr);

if (packages) {
packages.forEach((pkg) => {
for (const pkg of packages) {
const revision = pkg.revision || pkg.Revision || pkg.version || pkg.Version;

@@ -25,16 +26,19 @@ const version = pkg.versionExact || '#' + revision;

goProjectConfig.lockedVersions[dep.name] = dep;
});
if (event_loop_spinner_1.eventLoopSpinner.isStarving()) {
await event_loop_spinner_1.eventLoopSpinner.spin();
}
}
}
const ignores = gvJson.ignore || '';
ignores
.split(/\s/)
.filter((s) => {
// otherwise it's a build-tag rather than a pacakge
return s.indexOf('/') !== -1;
})
.forEach((pkgName) => {
for (let pkgName of ignores.split(/\s/)) {
if (pkgName.indexOf('/') === -1) {
continue; // it's a build-tag rather than a pacakge
}
pkgName = pkgName.replace(/\/+$/, ''); // remove trailing /
goProjectConfig.ignoredPkgs.push(pkgName);
goProjectConfig.ignoredPkgs.push(pkgName + '/*');
});
if (event_loop_spinner_1.eventLoopSpinner.isStarving()) {
await event_loop_spinner_1.eventLoopSpinner.spin();
}
}
return goProjectConfig;

@@ -46,3 +50,3 @@ }

}
function parseGoVendorConfig(manifestFileContents) {
async function parseGoVendorConfig(manifestFileContents) {
if (!manifestFileContents) {

@@ -49,0 +53,0 @@ throw new errors_1.InvalidUserInputError('vendor.json file contents are empty');

@@ -33,2 +33,3 @@ {

"@snyk/dep-graph": "^1.20.0",
"event-loop-spinner": "^2.1.0",
"toml": "^3.0.0",

@@ -51,3 +52,3 @@ "tslib": "^1.10.0"

},
"version": "1.7.0"
"version": "1.8.0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc