code: func importsOfFile(file *ast.File) (normalImports map[string]string, dotImports []string) {
  	normalImports = make(map[string]string)
  	dotImports = make([]string, 0)
  	for _, is := range file.Imports {
  		var pkgName string
  		importPath := is.Path.Value[1 : len(is.Path.Value)-1] // remove quotes
  
  		if is.Name != nil {
  			// Named imports are always certain.
  			if is.Name.Name == "_" {
  				continue
  			}
  			pkgName = is.Name.Name
  		} else {
  			pkg, err := build.Import(importPath, "", 0)
  			if err != nil {
  				// Fallback to import path suffix. Note that this is uncertain.
  				_, last := path.Split(importPath)
  				// If the last path component has dots, the first dot-delimited
  				// field is used as the name.
  				pkgName = strings.SplitN(last, ".", 2)[0]
  			} else {
  				pkgName = pkg.Name
  			}
  		}
  
  		if pkgName == "." {
  			dotImports = append(dotImports, importPath)
  		} else {
  
  			if _, ok := normalImports[pkgName]; ok {
  				log.Fatalf("imported package collision: %q imported twice", pkgName)
  			}
  			normalImports[pkgName] = importPath
  		}
  	}
  	return
  }
docs: // importsOfFile returns a map of package name to import path
  // of the imports in file.