type Dir … type Dirs … var dirs … // dirsInit starts the scanning of package directories in GOROOT and GOPATH. Any // extra paths passed to it are included in the channel. func dirsInit(extra ...Dir) { … } // goCmd returns the "go" command path corresponding to buildCtx.GOROOT. func goCmd() string { … } // Reset puts the scan back at the beginning. func (d *Dirs) Reset() { … } // Next returns the next directory in the scan. The boolean // is false when the scan is done. func (d *Dirs) Next() (Dir, bool) { … } // walk walks the trees in GOROOT and GOPATH. func (d *Dirs) walk(roots []Dir) { … } // bfsWalkRoot walks a single directory hierarchy in breadth-first lexical order. // Each Go source directory it finds is delivered on d.scan. func (d *Dirs) bfsWalkRoot(root Dir) { … } var testGOPATH … // codeRoots returns the code roots to search for packages. // In GOPATH mode this is GOROOT/src and GOPATH/src, with empty import paths. // In module mode, this is each module root, with an import path set to its module path. func codeRoots() []Dir { … } var codeRootsCache … var usingModules … func findCodeRoots() []Dir { … } type moduleJSON … var modFlagRegexp … // vendorEnabled indicates if vendoring is enabled. // Inspired by setDefaultBuildMod in modload/init.go func vendorEnabled() (*moduleJSON, bool, error) { … } // getMainModuleAnd114 gets the main module's information and whether the // go command in use is 1.14+. This is the information needed to figure out // if vendoring should be enabled. func getMainModuleAnd114() (*moduleJSON, bool, error) { … }