type Graph … func (g Graph) addEdge(from, to string) { … } // Search returns all the nodes of the graph reachable from // any of the specified roots, by following edges forwards. // Relationally, this is the reflexive transitive closure. func (g Graph) Search(roots ...string) map[string]bool { … } // Build scans the specified Go workspace and builds the forward and // reverse import dependency graphs for all its packages. // It also returns a mapping from canonical import paths to errors for packages // whose loading was not entirely successful. // A package may appear in the graph and in the errors mapping. // All package paths are canonical and may contain "/vendor/". func Build(ctxt *build.Context) (forward, reverse Graph, errors map[string]error) { … }