core/src/main/java/org/owasp/dependencycheck/analyzer/GolangModAnalyzer.java
/**
     * Reads the error stream and restarts the process with a different command
     * under certain error conditions.
     *
     * @param process the go process
     * @param directory the directory where the process is running
     * @return a reference to the process to evaluate; which may not be the
     * process passed as an argument
     * @throws InterruptedException thrown if the process is interrupted
     */
Reads the error stream and restarts the process with a different command
under certain error conditions.

@param process the go process
@param directory the directory where the process is running
@return a reference to the process to evaluate; which may not be the
process passed as an argument
@throws InterruptedException thrown if the process is interrupted
Reads the error stream and restarts the process with a different command under certain error conditions . @param process the go process @param directory the directory where the process is running @return a reference to the process to evaluate ; which may not be the process passed as an argument @throws InterruptedException thrown if the process is interrupted
private Process evaluateProcessErrorStream(Process process, File directory) throws AnalysisException, InterruptedException {
        try {
            String error = null;
            final InputStream errorStream = process.getErrorStream();
            if (errorStream.available() > 0) {
                error = IOUtils.toString(errorStream, StandardCharsets.UTF_8.name());
            }
            if (error != null) {
                LOGGER.warn("Warnings from go {}", error);
                if (error.contains("can't compute 'all' using the vendor directory")) {
                    LOGGER.warn("Switching to `go list -json -m readonly`");
                    process.destroy();
                    return evaluateProcessErrorStream(launchGoListReadonly(directory), directory);
                }
            }
        } catch (IOException ioe) {
            LOGGER.warn("go mod failure", ioe);
            throw new AnalysisException("Error running go: " + ioe.getMessage(), ioe);
        }
        return process;
    }
private Process evaluateProcessErrorStream ( Process process , File directory ) throws AnalysisException , InterruptedException { try { String error = null ; final InputStream errorStream = process . getErrorStream ( ) ; if ( errorStream . available ( ) > 0 ) { error = IOUtils . toString ( errorStream , StandardCharsets . UTF_8 . name ( ) ) ; } if ( error != null ) { LOGGER . warn ( "Warnings from go {}" , error ) ; if ( error . contains ( "can't compute 'all' using the vendor directory" ) ) { LOGGER . warn ( "Switching to `go list -json -m readonly`" ) ; process . destroy ( ) ; return evaluateProcessErrorStream ( launchGoListReadonly ( directory ) , directory ) ; } } } catch ( IOException ioe ) { LOGGER . warn ( "go mod failure" , ioe ) ; throw new AnalysisException ( "Error running go: " + ioe . getMessage ( ) , ioe ) ; } return process ; }
Reads the error stream and restarts the process with a different command
 under certain error conditions.
Reads the error stream and restarts the process with a different command under certain error conditions .