pkggraph

package
v0.0.0-...-a03bce3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortNodes

func SortNodes(xs []*Node)

Types

type Graph

type Graph struct {
	Packages map[string]*Node
	Sorted   []*Node
	stat.Stat
}

func From

func From(pkgs map[string]*packages.Package) *Graph

From creates a new graph from a map of packages.

func (*Graph) AddNode

func (g *Graph) AddNode(n *Node)

func (*Graph) Tree

func (graph *Graph) Tree() *Tree

Tree returns Node tree.

type Node

type Node struct {
	ImportsNodes []*Node

	// Stats about the current node.
	stat.Stat
	// Stats about upstream nodes.
	Up stat.Stat
	// Stats about downstream nodes.
	Down stat.Stat

	Errors []error
	Graph  *Graph

	*packages.Package
}

func LoadNode

func LoadNode(p *packages.Package) *Node

func (*Node) Pkg

func (n *Node) Pkg() *packages.Package

type Tree

type Tree struct {
	Path    string
	Package *Node

	Child map[string]*Tree

	Parent   *Tree
	Children []*Tree
}

func NewTree

func NewTree(parent *Tree, path string) *Tree

func (*Tree) Add

func (tree *Tree) Add(pkg *Node)

func (*Tree) HasParent

func (tree *Tree) HasParent(parent *Tree) bool

func (*Tree) Insert

func (tree *Tree) Insert(prefix, suffix []string, pkg *Node)

func (*Tree) LookupTable

func (tree *Tree) LookupTable() map[*Node]*Tree

func (*Tree) Sort

func (tree *Tree) Sort()

func (*Tree) Walk

func (tree *Tree) Walk(fn func(tree *Tree))

Jump to

Keyboard shortcuts

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