
import subprocess


SCANNER_INSTALLATION_INSTRUCTIONS = {
                                     "safesql":"github.com/stripe/safesql",
                                     "gas":"github.com/GoASTScanner/gas"
                                    }
GO_CMD = "go"

class InstallGOScanners:

    '''Install the scanners as needed

    '''

    def install_scanner(self, scannerName):
        try:
            scanner_installation_message = subprocess.check_output([GO_CMD,
                                                "get", SCANNER_INSTALLATION_INSTRUCTIONS[scannerName]])
            print(scanner_installation_message.decode("utf-8"))
            print("\nINFO: {0} installed successfully!".format(scannerName))
            return 1
        except subprocess.CalledProcessError as err:
            print("\n\nERROR: {0} installation failed with error {1}".format(scannerName, str(err)))
            return 0

Install scanners that are not installed based on user selection