package dep
import "cuelang.org/go/internal/core/dep"
Package dep analyzes dependencies between values.
Index ¶
- func Visit(cfg *Config, c *adt.OpContext, n *adt.Vertex, f VisitFunc) error
- type Config
- type Dependency
- func (d *Dependency) Import() *adt.ImportReference
- func (d *Dependency) IsRoot() bool
- func (d *Dependency) Recurse()
- type VisitFunc
Functions ¶
func Visit ¶
Visit calls f for the dependencies of n as determined by the given configuration.
Types ¶
type Config ¶
type Config struct {
// Dynamic enables evaluting dependencies Vertex Arcs, recursively
Dynamic bool
// Descend enables recursively descending into fields. This option is
// implied by Dynamic.
Descend bool
// Cycles allows a Node to reported more than once. This includes the node
// passed to Visit, which is otherwise never reported. This option can be
// used to disable cycle checking. TODO: this is not yet implemented.
AllowCycles bool
// Rootless enables reporting nodes that do not have a path from the root.
// This includes variables of comprehensions and fields of composite literal
// values that are part of expressions, such as {out: v}.out.
Rootless bool
// pkg indicates the main package for which the analyzer is configured,
// which is used for reporting purposes.
Pkg *adt.ImportReference
}
type Dependency ¶
type Dependency struct {
// Node is the referenced node.
Node *adt.Vertex
// Reference is the expression that referenced the node.
Reference adt.Resolver
// contains filtered or unexported fields
}
A Dependency is a reference and the node that reference resolves to.
func (*Dependency) Import ¶
func (d *Dependency) Import() *adt.ImportReference
Import returns the import reference or nil if the reference was within the same package as the visited Vertex.
func (*Dependency) IsRoot ¶
func (d *Dependency) IsRoot() bool
IsRoot reports whether the dependency is referenced by the root of the original Vertex passed to any of the Visit* functions, and not one of its descendent arcs. This always returns true for Visit.
func (*Dependency) Recurse ¶
func (d *Dependency) Recurse()
Recurse visits the dependencies of d.Node, using the same visit function as the original.
type VisitFunc ¶
type VisitFunc func(Dependency) error
VisitFunc is used for reporting dependencies.
Source Files ¶
dep.go mixed.go
- Version
- v0.15.1 (latest)
- Published
- Nov 21, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 4 months ago –
Tools for package owners.