Documentation ¶
Index ¶
- Constants
- type Leaf
- type Tree
- func (t *Tree) Add(name string) (bool, error)
- func (t *Tree) AddRecursive(name string) (bool, error)
- func (t *Tree) Branch(b string) error
- func (t *Tree) Broaden() []map[string]string
- func (t *Tree) Graphviz() (string, error)
- func (t *Tree) Grow(count int)
- func (t *Tree) Keep(name string) error
- func (t *Tree) PackageNames() []string
- func (t *Tree) Prune()
- func (t *Tree) SetIncludeExts(includeExts bool)
- func (t *Tree) SetIncludeTests(includeTests bool)
- func (t *Tree) Stats() string
- func (t *Tree) String() string
Constants ¶
const ( Blue = "#76E1FE" Green = "green" Orange = "#fcd92d" Red = "red" BrokenColor = Red RootColor = Green SingleParentColor = Orange UserKeepColor = Blue )
just some constants for use with the tree output
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Leaf ¶
type Leaf struct {
// contains filtered or unexported fields
}
Leaf contains helpful information about each package, like the package itself, a friendly display name, and whether or not the tree wants to keep it.
func (*Leaf) ImportCount ¶
ImportCount returns the receiver's import-count
func (*Leaf) SetDisplayName ¶
SetDisplayName modifies the receiver's display name
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree isn't actually a tree structure, but maintains a map of package names to Leaves.
func (*Tree) AddRecursive ¶
AddRecursive will attempt to add a package to the tree as a "root". Then, it will recursively call itself on all of that package's imports.
func (*Tree) Broaden ¶
Broaden returns a list of maps. Each map has one key, and that key and value each represent a package name. Each map represents "this package imports that package".
func (*Tree) Graphviz ¶
Graphviz returns the tree's representation in the graphviz source language, as for use with the `dot` command-line tool. See https://graphviz.org/documentation/ for more information.
func (*Tree) Grow ¶
Grow expands the "tree" of kept packages by the given count. This works in both directions (ancestors and descendants).
func (*Tree) Keep ¶
Keep marks a single package in the receiver for keeping. Should only be used as a result of user action (e.g. not for automatic "grow" operations)
func (*Tree) PackageNames ¶
PackageNames returns a sorted list of all of the tree's packages
func (*Tree) Prune ¶
func (t *Tree) Prune()
Prune removes all packages and package imports from the tree that are not marked for keeping.
func (*Tree) SetIncludeExts ¶
SetIncludeExts modifies the receiver to include or exclude packages outside the receiver's parent directory.
func (*Tree) SetIncludeTests ¶
SetIncludeTests modifies the receiver to include or exclude imports from Go test files.