graph

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package graph provides functionality for building and analyzing Go dependency graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	From string
	To   string
}

Edge represents a dependency relationship between two packages.

type Graph

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

Graph represents a complete dependency graph for a Go project.

func New

func New(gomod, root string, maxGoroutines uint) (*Graph, error)

New creates a new graph of dependencies starting from the root directory. maxGoroutines is the maximum number of goroutines to use for parsing in parallel.

func (*Graph) Edges

func (g *Graph) Edges() []Edge

Edges returns all edges in the dependency graph.

func (*Graph) Nodes

func (g *Graph) Nodes() []Node

Nodes returns all nodes in the dependency graph.

type Node

type Node struct {
	ImportPath string
	Name       string
	PkgType    PkgTypeEnum
}

Node represents a package node in the dependency graph.

type PkgTypeEnum

type PkgTypeEnum string

PkgTypeEnum represents the type of a Go package (standard library, external, local, or error).

const (
	PkgTypeStdLib PkgTypeEnum = "std" // Standard library package
	PkgTypeExtLib PkgTypeEnum = "ext" // External package (from go.mod)
	PkgTypeLocal  PkgTypeEnum = "loc" // Local project package
	PkgTypeErr    PkgTypeEnum = "err" // Package with import errors
)

Package type constants.

Jump to

Keyboard shortcuts

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