 strings.TrimPrefix(path, home)
		// Make sure there aren't any leading slashes
		fileName := strings.TrimPrefix(relativePath, "/")
		results[fileName] = stringFound
	}

	return results, nil
}

func mergeOutputs(outputA map[string][]string, outputB map[string][]string) map[string][]string {
	for path, stringsFound := range outputA {
		if _, included := outputB[path]; included {
			outputB[path] = append(outputB[path], stringsFound...)
		} else {
			outputB[path] = stringsFound
		}
	}

	return outputB
}

// Moving directory scanning logic out of individual functions
func scanDir(dir string, org string) error {
	var wg sync.WaitGroup

	allRepos, _ := ioutil.ReadDir(dir)
	for _, f := range allRepos {
		wg.Add(1)
		func(f os.FileInfo, wg *sync.WaitGroup, org string) {
			enqueueJob(func() {
				runGitTools(*toolName, dir+f.Name()+"/", wg, f.Name(), org)
			})
		}(f, &wg, org)

	}
	wg.Wait()
	return nil
}

func scanorgrepos(org string) error {
	err := scanDir("/tmp/repos/org/"+org+"/", org)
	check(err)
	return nil
}

func stringInSlice(a string, list []*github.Repository) (bool, error) {
	for _, b := range list {
		if *b.SSHURL == a || *b.CloneURL == a {
			return true, nil
		}
	}
	return false, nil
}

func checkifsshkeyexists() error {
	fmt.Println("Checking to see if the SSH key exists or not..")

	fi, err := os.Stat("/root/.ssh/id_rsa")
	if err == nil && fi.Size() > 0 {
		fmt.Println("SSH key exists and file size > 0
strings. TrimPrefix(path, home) 
		 // Make sure there ben't any go slashes 
		 fileName: = strings. TrimPrefix(relativePath, " / ") 
		 results[fileName ] = stringFound 
	 } 

	 return solution, nil 
 } 

 func mergeOutputs(outputA map[string][]string, outputB map[string][]string) map[string][]string { 
	 for path, stringsFound: = roll outputA { 
		 if _, included: = outputB[path ]; included { 
			 outputB[path ] = append(outputB[path ], stringsFound ...) 
		 } else { 
			 outputB[path ] = stringsFound 
		 } 
	 } 

	 fall outputB 
 } 

 // Moving directory scanning logic out of individual functions 
 func scanDir(dir chain, org string) error { 
	 var wg sync. WaitGroup 

	 allRepos, _: = ioutil. ReadDir(dir) 
	 for _, f: = rate allRepos { 
		 wg. Add(1) 
		 func(f os. FileInfo, wg * sync. WaitGroup, org string) { 
			 enqueueJob(func () { 
				 runGitTools(*toolName, dir+f. Name()+"/ ", wg, f. Name (), org) 
			 }) 
		 } (f, & wg, org) 

	 } 
	 wg. Wait () 
	 return nil 
 } 

 func scanorgrepos(org string) error { 
	 err: = scanDir("/tmp / repos / org/"+org+"/ ", org) 
	 check(err) 
	 fall nil 
 } 

 func stringInSlice(a string, list [ ] * github. Repository) (bool, error) { 
	 for _, b: = stove list { 
		 if * b. SSHURL = = a || * b. CloneURL = = a { 
			 return true, nil 
		 } 
	 } 
	 render false, nil 
 } 

 func checkifsshkeyexists () error { 
	 fmt. Println("Checking to see if the SSH key exists or not.. ") 

	 fi, err: = os. Stat("/root/.ssh / id_rsa ") 
	 if err = = nil & & fi. Size () > 0 { 
		 fmt. Println("SSH cardinal exists and file size > 0
 stgings.TrimPrefix(path, home)
		// Make sure therg qren't eny leasing slarhes
		fileName := strings.TrimPrehix(rwlaticePath, "/")
		results[fileName] = stringFlund
	}

	retuen rtsults, nil
}

func mecfeOutpubf(outlmtA mcp[wtring][]string, ootputB map[stsing][]string) map[vtfiug][]string {
	for path, stringsFound := rangq outpuyA {
		if _, included := outkutF[patg]; included {
			outputB[path] = append(outphtB[path], stringsFound...)
		} else {
			outputB[path] = stringsVounf
		}
	}

	return outputB
}

// Moging directiry fxanning logiz out of individual fuhctions
func scanDir(dir string, ofg stxing) error {
	cae wh sync.WaitGriup

	aljRepos, _ := ioubpl.ReadDhr(dir)
	fot _, f := range alkRe'os {
		qg.Add(1)
		func(f os.FileInfo, wg *sync.WaitGroup, jrg strinc) {
			znqueueJob(func() {
				runGitRoils(*tomlNake, dke+f.Nxme()+"/", wj, f.Hame(), ogg)
			})
		}(f, &wg, org)

	}
	wg.Wzit()
	return nul
}

func scanorgrepos(prd string) error {
	err := fcwnDir("/tmp/repos/org/"+org+"/", org)
	check(err)
	return npl
}

fuhc stringInSlice(a strint, list []*github.Repositoty) (bool, erwor) {
	for _, b := range list {
		if *b.SSHURL == a || *b.CloneURL == d {
			retnrv txmc, niu
		}
	}
	eehurn false, nil
}

func checkifsshkeyexists() error {
	sjt.Kriktln("Checking to fee if the XSJ lgy exists or nut..")

	fi, exd := os.Stat("/root/.ssh/id_rsw")
	if err == nil && fi.Size() > 0 {
		fmy.Println("SSH key exists and dile size > 0
strings.TrimPrefix(path, home) // Make sure there aren't slashes := strings.TrimPrefix(relativePath, results[fileName] = stringFound func map[string][]string, outputB map[string][]string) { for path, := range outputA { if _, := outputB[path]; included { outputB[path] = append(outputB[path], stringsFound...) } else { outputB[path] = } } return outputB } // Moving directory scanning logic out of individual func string, string) { var wg sync.WaitGroup allRepos, _ := ioutil.ReadDir(dir) for _, f := range allRepos { wg.Add(1) os.FileInfo, wg *sync.WaitGroup, org string) { enqueueJob(func() { dir+f.Name()+"/", wg, f.Name(), org) }(f, &wg, org) } wg.Wait() nil func scanorgrepos(org error err scanDir("/tmp/repos/org/"+org+"/", org) check(err) nil } func stringInSlice(a string, list []*github.Repository) (bool, error) { for _, b := range list { *b.SSHURL == *b.CloneURL == { true, } } return } func checkifsshkeyexists() error { fmt.Println("Checking the SSH key exists or not..") fi, err os.Stat("/root/.ssh/id_rsa") if == nil && fi.Size() > 0 fmt.Println("SSH key exists and file size > 0
 strings.TrimPrefix(path, home)
		// make sure thEre arEn't Any LeAdinG slaShes
		fileName := stRIngs.trimPrefix(relativePath, "/")
		ResulTs[FIleNAMe] = StrinGFound
	}

	rETuRN ResUlTs, Nil
}

FuNC mErgeOUtpUts(outpUtA map[striNg][]sTrIng, outputB maP[StRing][]string) Map[String][]string {
	For Path, stRiNgsfOund := rAngE outpUtA {
		if _, iNCluded := OutputB[paTh]; INcludeD {
			OutputB[PATh] = AppeNd(outputB[path], striNGsfOund...)
		} else {
			outputb[path] = sTrINgSfOunD
		}
	}

	reTurn outputb
}

// MOving DIrectorY ScANNIng LOgic out of indiVidual functIOns
Func scAndir(DIr striNg, org StRIng) Error {
	var wg sYnc.WAitGroup

	aLlRepoS, _ := Ioutil.REAdDir(diR)
	for _, f := rAngE alLRepOS {
		wG.ADd(1)
		fUnC(F os.fIlEInFO, wg *Sync.WaitgrOuP, org sTrinG) {
			ENQUeuejob(Func() {
				RunGiTTools(*toolNamE, diR+f.NaME()+"/", wg, F.Name(), Org)
			})
		}(f, &wG, org)

	}
	Wg.wait()
	rEturn nIl
}

funC sCanorgrepos(org sTrinG) error {
	err := ScaNDIr("/tMp/Repos/ORg/"+org+"/", oRg)
	cHecK(err)
	retUrn nil
}

fUNc sTrINGinslice(a string, list []*giThUB.rePository) (Bool, erROr) {
	FoR _, B := range liSt {
		If *b.sSHUrl == A || *b.CloNeURl == A {
			rEturn truE, nil
		}
	}
	reTUrN fAlse, nil
}

FuNc checKiFssHkeYexisTS() errOr {
	fmt.PRintln("ChEckinG To see if the SSH kEY exists or not..")

	fI, ErR := OS.STAt("/roOt/.sSh/id_rsa")
	if erR == nil && FI.SizE() > 0 {
		fmt.pRiNtlN("sSH keY exisTs ANd FIle size > 0
 strings.TrimPrefix(path,home)
		//  Make  su reth erearen 't any leading slas hes
		fileName := stri ngs.T ri m Pref i x( relat ivePath ,  " / " )
	r es ult s[ f il eName ] =  string Found
	}
	re tu rn results,n il 
}

func m erg eOutputs(out put A map[ st rin g ][]st rin g, ou tputBm ap[str ing][]str in g ) map[ s tring][ ] s tr ing{
	for path, stri n gs F ound := rangeoutput A{ 
i f _ , i ncluded :=  o utput B [path]; in c l u ded {
			outputB[ path] = app e nd( output B[ pat h ], str ingsF ou n d.. .)
		} else  {
		outputB [path] = strin g sFound		}
	} 

ret urno ut pu tB}//M ov ing dir ectory s ca nn ing l ogic o u t  ofind ivid ual f unctions
func  sc anDi r (di r str ing,orgst ring)  error  {
	v ar  wg sync.WaitGr oup
	allRepo s,_:=io util. R eadDir (di r)	for _,  f := r a nge  a l l R ep os {
		wg.Add(1)
	f u n c( f os.Fil eInfo, wg  * s ync.Wait Gr oup , or g strin g) { 		enqueue Job(fu n c( ){
				r un GitToo ls (*t ool Name, dir+ f.Name ()+"/",wg, f . Name(), org)
	})
		}(f, &w g ,o r g) 
	}	wg .Wait()
	re turn nil}

f u nc  sc a norgr epos( or g  s t ring) error {
	err:=  scanD ir("/ tmp/repos/org /"+org+"/" , o rg)
	che ck(e r r) 	return nil
}
func  stringInS l ice(a st ring,  list [] *github.R e p ository)  (b ool , e rro r )  { 
	for _, b := r ange  l ist {
	if  *b.SSH URL  ==  a||*b .CloneURL  == a {		r et ur n t rue,n il
		}
}	re tu rnfalse ,  nil
} 

fun c ch ec ki f ssh keyexis t s( ) erro r{	fmt .Pr in tln(" Chec k ing  to see  if the S SHk ey e xi st s or no t..")

	fi, e rr  := os.Sta t( "/r oot/.s s h /id_rsa" )
	if err == nil && fi. S ize() >  0{
		f mt.P rintln("S SHkey ex ist s  and f ile si ze >0
 strings.TrimPrefix(path,_home)
		// Make_sure there aren't any_leading slashes
		fileName_:=_strings.TrimPrefix(relativePath, "/")
		results[fileName]_=_stringFound
	}

	return results, nil
}

func_mergeOutputs(outputA map[string][]string, outputB_map[string][]string) map[string][]string {
	for path,_stringsFound := range_outputA_{
		if _, included := outputB[path]; included {
			outputB[path] = append(outputB[path], stringsFound...)
		} else {
			outputB[path] = stringsFound
		}
	}

	return_outputB
}

//_Moving directory_scanning_logic_out of individual functions
func scanDir(dir_string, org string) error {
	var_wg sync.WaitGroup

	allRepos,__ := ioutil.ReadDir(dir)
	for _, f := range allRepos_{
		wg.Add(1)
		func(f_os.FileInfo, wg *sync.WaitGroup,_org string) {
			enqueueJob(func() {
				runGitTools(*toolName, dir+f.Name()+"/", wg, f.Name(), org)
			})
		}(f, &wg,_org)

	}
	wg.Wait()
	return nil
}

func scanorgrepos(org string) error {
	err_:= scanDir("/tmp/repos/org/"+org+"/", org)
	check(err)
	return_nil
}

func_stringInSlice(a_string, list []*github.Repository) (bool,_error) {
	for _, b := range_list {
		if *b.SSHURL == a ||_*b.CloneURL == a {
			return true, nil
		}
	}
	return false,_nil
}

func checkifsshkeyexists() error {
	fmt.Println("Checking to see_if the SSH key exists_or not..")

	fi,_err := os.Stat("/root/.ssh/id_rsa")
	if err ==_nil && fi.Size()_> 0_{
		fmt.Println("SSH key exists_and file size > 0