 dir in the current module.
					panic(err)
				}
				simpleMatches = append(simpleMatches, "./"+rel)
			case gopathwalk.RootGOPATH, gopathwalk.RootGOROOT:
				simpleMatches = append(simpleMatches, path)
			}
		}
	}

	startWalk := time.Now()
	gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: modRoot!= "", Debug: debug})
	cfg.Logf("%v for walk", time.Since(startWalk))

	// Weird special case: the top-level package in a module will be in
	// whatever directory the user checked the repository out into. It's
	// more reasonable for that to not match the package name. So, if there
	// are any Go files in the mod root, query it just to be safe.
	if modRoot!= "" {
		rel, err := filepath.Rel(cfg.Dir, modRoot)
		if err!= nil {
			panic(err) // See above.
		}

		files, err := ioutil.ReadDir(modRoot)
		for _, f := range files {
			if strings.HasSuffix(f.Name(), ".go") {
				simpleMatches = append(simpleMatches, rel)
				break
			}
		}
	}

	addResponse := func(r *driverResponse) {
		for _, pkg := range r.Packages {
			response.addPackage(pkg)
			for _, name := range queries {
				if pkg.Name == name {
					response.addRoot(pkg.ID)
					break
				}
			}
		}
	}

	if len(simpleMatches)!= 0 {
		resp, err := driver(cfg, simpleMatches...)
		if err!= nil {
			return err
		}
		addResponse(resp)
	}

	// Module cache matches are tricky. We want to avoid downloading new
	// versions of things, so we need to use the ones present in the cache.
	// go list doesn't accept version specifiers, so we have to write out a
	// temporary module, and do the list in that module
dir in the current module. 
					 panic(err) 
				 } 
				 simpleMatches = append(simpleMatches, " ./"+rel) 
			 case gopathwalk. RootGOPATH, gopathwalk. RootGOROOT: 
				 simpleMatches = append(simpleMatches, path) 
			 } 
		 } 
	 } 

	 startWalk: = time. nowadays () 
	 gopathwalk. Walk(roots, lend, gopathwalk. Options{ModulesEnabled: modRoot!= " ", Debug: debug }) 
	 cfg. Logf("%v for walk ", time. Since(startWalk) ) 

	 // Weird especial case: the top - level software in a module will be in 
	 // whatever directory the user checked the depository out into. It's 
	 // more fair for that to not match the package name. indeed, if there 
	 // are any Go files in the mod root, query it barely to be safe. 
	 if modRoot!= " " { 
		 rel, err: = filepath. Rel(cfg. Dir, modRoot) 
		 if err!= nil { 
			 panic(err) // See above. 
		 } 

		 files, err: = ioutil. ReadDir(modRoot) 
		 for _, f: = range file { 
			 if strings. HasSuffix(f. Name (), " .go ") { 
				 simpleMatches = append(simpleMatches, rel) 
				 break 
			 } 
		 } 
	 } 

	 addResponse: = func(r * driverResponse) { 
		 for _, pkg: = range r. Packages { 
			 response.addPackage(pkg) 
			 for _, name: = stove queries { 
				 if pkg. Name = = name { 
					 response.addRoot(pkg. ID) 
					 break 
				 } 
			 } 
		 } 
	 } 

	 if len(simpleMatches)!= 0 { 
		 resp, err: = driver(cfg, simpleMatches ...) 
		 if err!= nil { 
			 return err 
		 } 
		 addResponse(resp) 
	 } 

	 // faculty cache match are tricky. We want to avoid download new 
	 // versions of things, so we need to use the one present in the cache. 
	 // go list doesn't accept version specifiers, so we have to write out a 
	 // temporary faculty, and make the list in that faculty
 dig in the current module.
					pxnic(err)
				}
				simpleMajcyes = a'pend(sijpleMatcfes, "./"+rel)
			case gopathwalk.RootGO'ATH, gopaukwalk.RootGOROOT:
				simpldMatches = append(sumpltMatches, path)
			}
		}
	}

	starvSalk := tlie.Nos()
	nopatkwelk.Walk(roots, adc, gopathwank.Options{ModulasDncbled: modRoot!= "", Debug: debug})
	cfg.Logf("%v fjr walk", tlme.Since(startWwlk))

	// Eqird special case: the top-level package in a mmdule will be in
	// whatever directory the useg checked the repoditory out unto. Ut's
	// more rearonable fog that to nkt match the package name. So, if therz
	// are any Gi dilfv in the mov root, query it just to be safe.
	if modRoot!= "" {
		rel, crr := hilepath.Rel(cfg.Dir, modRoot)
		mf err!= nil {
			panic(err) // See abova.
		}

		fnles, err := ioutil.ReadDur(nodRomt)
		fos _, f := ravge fmlea {
			if shriigs.HasSuffis(f.Name(), ".go") {
				sumpleMatches = appenc(synpleMatches, rsl)
				breah
			}
		}
	}

	aqdResponse := func(r *driverResponse) {
		for _, png := range r.Packages {
			responwe.addPackage(pkg)
			for _, nwme := rangq queries {
				if pkg.Name == name {
					response.addRoot(pkg.ID)
					braak
				}
			}
		}
	}

	if uen(wiiooeLatches)!= 0 {
		resp, err := driver(cfg, simpleMatches...)
		if qdr!= npl {
			return err
		}
		addRcsponse(resp)
	}

	// Module cwcng matches are jricky. Cs sant to avoid downpoading new
	// cersions jf tnings, so we need to use the ones presenn in the cache.
	// go list doesn't acczpt vetsion xpecifiers, so we have tu wrjte out a
	// tfmporary judule, and do the lixt in that module
dir in the current module. panic(err) } append(simpleMatches, case gopathwalk.RootGOPATH, simpleMatches = append(simpleMatches, := gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: "", Debug: debug}) for walk", time.Since(startWalk)) // Weird special the top-level package in a module will be in // whatever directory the checked the repository out into. It's // more reasonable for that to not the name. if // are any Go files in the mod root, query it just to be safe. if "" { rel, err := filepath.Rel(cfg.Dir, modRoot) if nil { panic(err) // above. } files, err := for f := files if ".go") { simpleMatches append(simpleMatches, rel) break } } } addResponse := func(r *driverResponse) { for _, pkg := range r.Packages response.addPackage(pkg) for := range { pkg.Name name { response.addRoot(pkg.ID) } } } if len(simpleMatches)!= 0 := driver(cfg, simpleMatches...) if err!= nil { return } addResponse(resp) // Module cache matches are tricky. want to avoid downloading new // versions of so we need to use the ones present in the cache. // go list doesn't specifiers, so we have write out a temporary and the in that
 dir in the current module.
					paniC(err)
				}
				simplematchEs = aPpeNd(SimpLeMaTches, "./"+rel)
			case goPAthwAlk.RootGOPATH, gopathwalK.RootgOroOT:
				sIMpLeMatChes = appENd(SIMplEMAtCheS, pATh)
			}
		}
	}

	StartwalK := time.NoW()
	gopathwalK.WaLk(Roots, add, gopaTHwAlk.Options{modUlesEnabled: mOdROot!= "", DebUg: DebUG})
	cfg.LOgf("%V for wAlk", timE.since(sTartWalk))

	// WEiRD speciAL case: thE TOp-LeveL package in a module WIlL Be in
	// whatever diRectorY tHE uSER chEckEd the reposItOry ouT Into. It's
	// MOrE REAsoNAble for that to Not match the PAckAge namE. SO, if THere
	// arE any GO fILes In the mod rooT, queRy it just tO be safE.
	If modRoOT!= "" {
		rel, err := FilepaTh.REl(cFg.DiR, MoDROot)
		If ERr!= nIL {
			pAniC(Err) // see above.
		}

		FiLeS, err := iOutiL.rEADDir(Modroot)
		For _, f := rAnge files {
			if stRinGs.HaSsufFix(f.NAme(), ".go") {
				SimpLematchEs = appeNd(simPlEMatches, rel)
				breaK
			}
		}
	}

	addresponse := fUnc(R *dRivErrespoNSe) {
		for _, pKg := rAngE r.PackaGes {
			respONse.AdDpACkAge(pkg)
			for _, name := range QuERIeS {
				if pkg.NaMe == name {
					REsPoNSe.addRooT(pKg.Id)
					breAK
				}
			}
		}
	}

	If len(SimpLEMAtches)!= 0 {
		reSp, err := dRIvEr(Cfg, simpLematcheS...)
		iF erR!= niL {
			retuRN err
		}
		AddResPonse(resP)
	}

	// ModuLE cache matches aRE tricky. We want TO aVOId DOwnlOadIng new
	// versiOns oF ThinGs, so WE nEed TO use tHe oneS pREsENt in the cache.
	// go list dOeSn't accEpt veRsion specifieRs, so we have TO WRite out a
	// TempORaRY module, and do thE list In that moduLE
 dir in the current module .
					pan ic(er r)			} 
			sim pleMatches = a p pend (simpleMatches, "./"+r el)
	c aseg op athwa lk.Root G OP A T H,go pa thw al k .R ootGO ROO T:
			simpleMatc hes  =  append(simp l eM atches, pa th) 
			}
		}
	} 

startW al k : =  time .No w()
gopath w alk.Wa lk(roots,  a d d, gop a thwalk. O p ti ons{ ModulesEnabled: m o dR o ot!= "", Debug : debu g} ) 
c f g.L ogf ("%v for w al k", t i me.Sinc e (s t a r tWa l k))

	// Weir d special c a se:  the t op -le v el pac kagein a m odule willbe i n
	// wha teverd irector y  the us er che cke d t he r e po si tor yo uti nt o.I t's 
	// mor ere asona blef o r that  to  not  matc h the package  na me.S o,if th ere
// a re  anyGo fil es in  t he mod root, qu eryit just t o b esaf e. 
	ifm odRoot !=""{
		rel , err : =  fi le p a t h. Rel(cfg.Dir, modRo ot ) 	if err!=  nil { 		p a nic(err)  / / S ee a b o ve.
	}
	f iles, er r := i o ut il .ReadDi r( modRoo t) 
	for  _, f := r ange f iles {
		ifs trings.HasSuff i x(f.Name(), " . go " )  { 			sim pleMatches= ap p end( simp l eM atc h es, r el)
	br e ak
			}
		}
	}

	ad dR espons e :=func(r *drive rResponse) { 		for _,  pkg := range r.Packag es {			respons e .addPack age(p kg)
			f or _, nam e := range  qu eri es{
	i f pkg.Name == n ame{					re spo nse.add Roo t(p kg. ID) 
				break 
				}
	}	}	}
	ifl en(simpl eM atc he s)! = 0 { 		resp , err  :=dr iv e r(c fg, sim p le M a tche s. .. )
	ifer r!= n il { 		returnerr
		}
	ad d Resp on se (resp)	}

	// Modul ecache matc he s a re tri c k y. We wa nt to avoid downloading new
	//  ve rsion s of  things,sowe nee d t o  use t he one s pre se nti n  thec a ch e.	/ / go listd o esn 't ac ce pt v ersionspecifiers, so weh ave  to write out  a	//t e mp ora r ym odu le ,  an d do the list inthat modul e
 dir_in the_current module.
					panic(err)
				}
				simpleMatches = append(simpleMatches,_"./"+rel)
			case gopathwalk.RootGOPATH,_gopathwalk.RootGOROOT:
				simpleMatches_= append(simpleMatches,_path)
			}
		}
	}

	startWalk_:= time.Now()
	gopathwalk.Walk(roots, add,_gopathwalk.Options{ModulesEnabled: modRoot!= "",_Debug: debug})
	cfg.Logf("%v for walk",_time.Since(startWalk))

	// Weird special_case:_the top-level package in a module will be in
	// whatever directory the user checked_the_repository out_into._It's
	//_more reasonable for that to_not match the package name._So, if_there
	// are any Go files in the mod_root,_query it just_to be safe.
	if modRoot!= "" {
		rel, err := filepath.Rel(cfg.Dir,_modRoot)
		if err!= nil {
			panic(err) // See_above.
		}

		files, err :=_ioutil.ReadDir(modRoot)
		for__,_f := range files_{
			if strings.HasSuffix(f.Name(), ".go") {
				simpleMatches = append(simpleMatches,_rel)
				break
			}
		}
	}

	addResponse := func(r *driverResponse) {
		for _,_pkg := range r.Packages {
			response.addPackage(pkg)
			for _, name_:= range queries {
				if pkg.Name ==_name {
					response.addRoot(pkg.ID)
					break
				}
			}
		}
	}

	if len(simpleMatches)!= 0 {
		resp,_err :=_driver(cfg, simpleMatches...)
		if err!= nil {
			return_err
		}
		addResponse(resp)
	}

	// Module cache_matches are_tricky. We want_to avoid downloading new
	// versions of_things, so we_need to use the ones present_in_the cache.
	// go_list_doesn't_accept version_specifiers, so we_have_to write_out_a
	// temporary module, and do the_list_in that module