code: func ListImports(importPath, rootPath, vendorPath, srcPath, tags string, isTest bool) ([]string, error) {
  	oldGOPATH := os.Getenv("GOPATH")
  	sep := ":"
  	if runtime.GOOS == "windows" {
  		sep = ";"
  	}
  
  	ctxt := build.Default
  	ctxt.BuildTags = strings.Split(tags, " ")
  	ctxt.GOPATH = vendorPath + sep + oldGOPATH
  	if setting.Debug {
  		log.Debug("Import/root path: %s : %s", importPath, rootPath)
  		log.Debug("Context GOPATH: %s", ctxt.GOPATH)
  		log.Debug("Source path: %s", srcPath)
  	}
  	pkg, err := ctxt.Import(importPath, srcPath, build.AllowBinary)
  	if err != nil {
  		if _, ok := err.(*build.NoGoError); !ok {
  			return nil, fmt.Errorf("fail to get imports(%s): %v", importPath, err)
  		}
  		log.Warn("Getting imports: %v", err)
  	}
  
  	rawImports := pkg.Imports
  	numImports := len(rawImports)
  	if isTest {
  		rawImports = append(rawImports, pkg.TestImports...)
  		numImports = len(rawImports)
  	}
  	imports := make([]string, 0, numImports)
  	for _, name := range rawImports {
  		if IsGoRepoPath(name) {
  			continue
  		} else if strings.HasPrefix(name, rootPath) {
  			moreImports, err := ListImports(name, rootPath, vendorPath, srcPath, tags, isTest)
  			if err != nil {
  				return nil, err
  			}
  			imports = append(imports, moreImports...)
  			continue
  		}
  		if setting.Debug {
  			log.Debug("Found dependency: %s", name)
  		}
  		imports = append(imports, name)
  	}
  	return imports, nil
  }
docs: // ListImports checks and returns a list of imports of given import path and options.