dep

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package dep provides utilities to find dependencies in the manifest files of many different package managers.

Index

Constants

View Source
const (
	ManagerTypeDotnet     = "dotnet"
	ManagerTypeElixir     = "elixir"
	ManagerTypeGo         = "go"
	ManagerTypeJava       = "java"
	ManagerTypeJavaScript = "js"
	ManagerTypePHP        = "php"
	ManagerTypePython     = "python"
	ManagerTypeRuby       = "ruby"
	ManagerTypeRust       = "rust"
)

Variables

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Vendor     string // The vendor, if any.
	Name       string // The standard package name, which may include the vendor name.
	Constraint string // The version constraint.
	Version    string // The resolved version (e.g. from a lock file).
	IsDirect   bool   // True if explicitly specified in manifest, false if transitive/from lock file only.
	IsDevOnly  bool   // True if this is a development-only dependency.
	ToolName   string // The external name of the tool that manages this dependency (e.g. "uv", "poetry", "composer").
}

type Manager

type Manager interface {
	// Init collects data for the manager: parsing files, etc.
	// Implementations may be run multiple times: they should ensure they only read files once.
	Init() error

	// Get finds a specific dependency by name.
	Get(name string) (Dependency, bool)

	// Find looks for dependencies using a wildcard pattern.
	Find(pattern string) []Dependency
}

func GetCachedManager

func GetCachedManager(managerType string, fsd fsdir.FSDir) (Manager, error)

GetCachedManager returns a cached and initialized dep.Manager for the given filesystem directory.

func GetManager

func GetManager(managerType string, fsys fs.FS, path string) (Manager, error)

GetManager returns a dependency manager for the given type, filesystem and path. The caller must then use Manager.Init to ensure files are parsed, when necessary.

Jump to

Keyboard shortcuts

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