snyk 1.953.0 → 1.954.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -175739,7 +175739,7 @@ async function inspect(root, targetFile, options = {}) {
175739
175739
  options.debug ? debugLib.enable('snyk-go-plugin') : debugLib.disable();
175740
175740
  const result = await Promise.all([
175741
175741
  getMetaData(root, targetFile),
175742
- getDependencies(root, targetFile),
175742
+ getDependencies(root, targetFile, options.args),
175743
175743
  ]);
175744
175744
  const hasDepGraph = result[1].dependencyGraph && !result[1].dependencyTree;
175745
175745
  const hasDepTree = !result[1].dependencyGraph && result[1].dependencyTree;
@@ -175815,11 +175815,11 @@ const VENDOR_SYNC_CMD_BY_PKG_MANAGER = {
175815
175815
  govendor: 'govendor sync',
175816
175816
  gomodules: 'go mod download',
175817
175817
  };
175818
- async function getDependencies(root, targetFile) {
175818
+ async function getDependencies(root, targetFile, additionalArgs) {
175819
175819
  let tempDirObj;
175820
175820
  const packageManager = pkgManagerByTarget(targetFile);
175821
175821
  if (packageManager === 'gomodules') {
175822
- return { dependencyGraph: await buildDepGraphFromImportsAndModules(root, targetFile) };
175822
+ return { dependencyGraph: await buildDepGraphFromImportsAndModules(root, targetFile, additionalArgs) };
175823
175823
  }
175824
175824
  try {
175825
175825
  debug('parsing manifest/lockfile', { root, targetFile });
@@ -176012,7 +176012,7 @@ function pathToPosix(fpath) {
176012
176012
  const parts = fpath.split(path.sep);
176013
176013
  return parts.join(path.posix.sep);
176014
176014
  }
176015
- async function buildDepGraphFromImportsAndModules(root = '.', targetFile = 'go.mod') {
176015
+ async function buildDepGraphFromImportsAndModules(root = '.', targetFile = 'go.mod', additionalArgs = []) {
176016
176016
  // TODO(BST-657): parse go.mod file to obtain root module name and go version
176017
176017
  const projectName = path.basename(root); // The correct name should come from the `go list` command
176018
176018
  const projectVersion = '0.0.0'; // TODO(BST-657): try `git describe`?
@@ -176021,16 +176021,17 @@ async function buildDepGraphFromImportsAndModules(root = '.', targetFile = 'go.m
176021
176021
  version: projectVersion,
176022
176022
  });
176023
176023
  let goDepsOutput;
176024
+ const args = ['list', ...additionalArgs, '-json', '-deps', './...'];
176024
176025
  try {
176025
176026
  const goModAbsolutPath = path.resolve(root, path.dirname(targetFile));
176026
- goDepsOutput = await runGo(['list', '-json', '-deps', './...'], { cwd: goModAbsolutPath });
176027
+ goDepsOutput = await runGo(args, { cwd: goModAbsolutPath });
176027
176028
  }
176028
176029
  catch (err) {
176029
176030
  if (/cannot find main module, but found/.test(err)) {
176030
176031
  return depGraphBuilder.build();
176031
176032
  }
176032
176033
  const userError = new custom_error_1.CustomError(err);
176033
- userError.userMessage = "'go list -json -deps ./...' command failed with error: " + userError.message;
176034
+ userError.userMessage = `'go ${args.join(' ')}' command failed with error: ${userError.message}`;
176034
176035
  throw userError;
176035
176036
  }
176036
176037
  if (goDepsOutput.includes('matched no packages')) {
@@ -176043,8 +176044,7 @@ async function buildDepGraphFromImportsAndModules(root = '.', targetFile = 'go.m
176043
176044
  packagesByName[gp.ImportPath] = gp; // ImportPath is the fully qualified name
176044
176045
  }
176045
176046
  const localPackages = goDeps.filter((gp) => !gp.DepOnly);
176046
- const localPackageWithMainModule = localPackages
176047
- .find((localPackage) => !!(localPackage.Module && localPackage.Module.Main));
176047
+ const localPackageWithMainModule = localPackages.find((localPackage) => !!(localPackage.Module && localPackage.Module.Main));
176048
176048
  if (localPackageWithMainModule && localPackageWithMainModule.Module.Path) {
176049
176049
  depGraphBuilder = new dep_graph_1.DepGraphBuilder({ name: 'gomodules' }, {
176050
176050
  name: localPackageWithMainModule.Module.Path,
@@ -176154,11 +176154,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
176154
176154
  exports.execute = void 0;
176155
176155
  const childProcess = __webpack_require__(63129);
176156
176156
  function execute(command, args, options) {
176157
- if (process.env.TERM_PROGRAM === 'vscode') {
176158
- throw new Error('running go subprocesses in VS Code seems to be broken!');
176159
- // Namely, it seems that no data is collected from stdout/stderr streams.
176160
- // Even just running `go version > 1.txt` in the terminal produces an empty file.
176161
- }
176162
176157
  const spawnOptions = { shell: true };
176163
176158
  if (options === null || options === void 0 ? void 0 : options.cwd) {
176164
176159
  spawnOptions.cwd = options.cwd;