core/src/main/java/org/owasp/dependencycheck/analyzer/GolangModAnalyzer.java
/**
     * Analyzes go packages and adds evidence to the dependency.
     *
     * @param dependency the dependency being analyzed
     * @param engine the engine being used to perform the scan
     * @throws AnalysisException thrown if there is an unrecoverable error
     * analyzing the dependency
     */
Analyzes go packages and adds evidence to the dependency.
@param dependency the dependency being analyzed
@param engine the engine being used to perform the scan
@throws AnalysisException thrown if there is an unrecoverable error
analyzing the dependency
Analyzes go packages and adds evidence to the dependency . @param dependency the dependency being analyzed @param engine the engine being used to perform the scan @throws AnalysisException thrown if there is an unrecoverable error analyzing the dependency
@Override
    protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
        final int exitValue;
        final File parentFile = dependency.getActualFile().getParentFile();
        Process process = launchGoListAll(parentFile);
        try {
            process = evaluateProcessErrorStream(process, parentFile);
            try (InputStream inputStream = process.getInputStream()) {
                GoModJsonParser.process(inputStream).forEach(goDep
                        -> engine.addDependency(goDep.toDependency(dependency))
                );
            }
            process.waitFor();
            process.getInputStream().close();
            process.getErrorStream().close();
            exitValue = process.exitValue();
            if (exitValue < 0 || exitValue > 1) {
                final String msg = String.format("Unexpected exit code from go process; exit code: %s", exitValue);
                throw new AnalysisException(msg);
            }
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
            throw new AnalysisException("go process interrupted", ie);
        } catch (IOException ex) {
            throw new AnalysisException("Error closing the go process", ex);
        }
    }
@ Override protected void analyzeDependency ( Dependency dependency , Engine engine ) throws AnalysisException { final int exitValue ; final File parentFile = dependency . getActualFile ( ) . getParentFile ( ) ; Process process = launchGoListAll ( parentFile ) ; try { process = evaluateProcessErrorStream ( process , parentFile ) ; try ( InputStream inputStream = process . getInputStream ( ) ) { GoModJsonParser . process ( inputStream ) . forEach ( goDep -> engine . addDependency ( goDep . toDependency ( dependency ) ) ) ; } process . waitFor ( ) ; process . getInputStream ( ) . close ( ) ; process . getErrorStream ( ) . close ( ) ; exitValue = process . exitValue ( ) ; if ( exitValue < 0 || exitValue > 1 ) { final String msg = String . format ( "Unexpected exit code from go process; exit code: %s" , exitValue ) ; throw new AnalysisException ( msg ) ; } } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; throw new AnalysisException ( "go process interrupted" , ie ) ; } catch ( IOException ex ) { throw new AnalysisException ( "Error closing the go process" , ex ) ; } }
Analyzes go packages and adds evidence to the dependency.
Analyzes go packages and adds evidence to the dependency .
//engine.removeDependency(dependency);