depgraph

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepGraph

type DepGraph struct {
	Path string

	Main         *Dependency
	Dependencies *DependencyMap
	// contains filtered or unexported fields
}

DepGraph represents a Go module's dependency graph.

func GetDepGraph

func GetDepGraph(logger *logrus.Logger, path string) (*DepGraph, error)

GetDepGraph will return the dependency graph for the Go module that can be found at the specified path. The 'logger' parameter can be 'nil' which will result in no output or logging information being provided.

func NewGraph

func NewGraph(logger *logrus.Logger, path string, main *modules.Module) *DepGraph

NewGraph returns a new DepGraph instance which will use the specified logger for writing log output. If nil a null-logger will be used instead.

func (*DepGraph) AddDependency added in v0.5.0

func (g *DepGraph) AddDependency(module *modules.Module) *Dependency

func (*DepGraph) DeepCopy

func (g *DepGraph) DeepCopy() *DepGraph

DeepCopy returns a separate copy of the current dependency graph that can be safely modified without affecting the original graph.

func (*DepGraph) GetDependency added in v0.5.0

func (g *DepGraph) GetDependency(name string) (*Dependency, bool)

func (*DepGraph) PruneUnsharedDeps

func (g *DepGraph) PruneUnsharedDeps() *DepGraph

PruneUnsharedDeps returns a copy of the dependency graph with all dependencies removed that are not part of a chain leading to a dependency with more than two predecessors.

func (*DepGraph) RemoveDependency added in v0.5.0

func (g *DepGraph) RemoveDependency(name string)

func (*DepGraph) SubGraph

func (g *DepGraph) SubGraph(filters []*DependencyFilter) *DepGraph

SubGraph returns a copy of the dependency graph with all dependencies that are part of chains that need to be modified for the specified dependency to be set to a given target version annotated as such.

type Dependency added in v0.5.0

type Dependency struct {
	Module       *modules.Module
	Predecessors *DependencyMap
	Successors   *DependencyMap
}

Dependency represents a module in a Go module's dependency graph.

func (*Dependency) Name added in v0.5.0

func (n *Dependency) Name() string

Name of the module represented by this Dependency in the DepGraph instance.

func (*Dependency) SelectedVersion added in v0.5.0

func (n *Dependency) SelectedVersion() string

SelectedVersion corresponds to the version of the dependency represented by this Dependency which was selected for use.

func (*Dependency) Timestamp added in v0.5.0

func (n *Dependency) Timestamp() *time.Time

Timestamp returns the time corresponding to the creation of the version at which this dependency is used.

type DependencyFilter

type DependencyFilter struct {
	Module  string
	Version string
}

DependencyFilter allows to specify a dependency graph filter that removes any edges that are not part of a chain leading to this dependency. If a version is given then we only keep edges that prevent the use of the dependency at that given version due to the Go module's minimal version selection.

type DependencyMap added in v0.5.0

type DependencyMap struct {
	// contains filtered or unexported fields
}

func NewDependencyMap added in v0.5.0

func NewDependencyMap() *DependencyMap

func (*DependencyMap) Add added in v0.5.0

func (m *DependencyMap) Add(dependencyReference *DependencyReference)

func (*DependencyMap) Copy added in v0.5.0

func (m *DependencyMap) Copy() *DependencyMap

func (*DependencyMap) Delete added in v0.5.0

func (m *DependencyMap) Delete(name string)

func (*DependencyMap) Get added in v0.5.0

func (m *DependencyMap) Get(name string) (*DependencyReference, bool)

func (*DependencyMap) Len added in v0.5.0

func (m *DependencyMap) Len() int

func (*DependencyMap) List added in v0.5.0

func (m *DependencyMap) List() []*DependencyReference

type DependencyReference added in v0.5.0

type DependencyReference struct {
	*Dependency
	VersionConstraint string
}

Jump to

Keyboard shortcuts

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