importgraph

package
v0.0.0-...-fd97e0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2016 License: Apache-2.0, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package importgraph computes the forward and reverse import dependency graphs for all packages in a Go workspace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph map[string]map[string]bool

A Graph is an import dependency graph, either forward or reverse.

The graph maps each node (a package import path) to the set of its successors in the graph. For a forward graph, this is the set of imported packages (prerequisites); for a reverse graph, it is the set of importing packages (clients).

func Build

func Build(ctxt *build.Context) (forward, reverse Graph, errors map[string]error)

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 import paths to errors for packages whose loading was not entirely successful. A package may appear in the graph and in the errors mapping.

func (Graph) Search

func (g Graph) Search(roots ...string) map[string]bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL