pkgset

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStd

func IsStd(p *packages.Package) bool

IsStd returns whether *packages.Package is a std package

func IsStdName

func IsStdName(id string) bool

IsStdName returns whether id corresponds to a standard package

func IsTestPkg added in v0.5.0

func IsTestPkg(pkg *packages.Package) bool

func KeyValue

func KeyValue(s string) (string, string)

KeyValue parses s into a key and value.

func LoadStd added in v0.5.3

func LoadStd()

LoadStd preloads the std package list.

func Parse

func Parse(_ context.Context, expr []string) (ast.Expr, error)

Parse converts the expression represented by the expr strings into an AST representation.

Types

type Context

type Context struct {
	Context context.Context
	Tags    Strings
	Env     Strings
}

func (Context) Clone

func (ctx Context) Clone() *Context

func (Context) Config

func (ctx Context) Config() *packages.Config

func (Context) Load

func (ctx Context) Load(patterns ...string) ([]*packages.Package, error)

func (Context) LoadWithTests added in v0.4.2

func (ctx Context) LoadWithTests(patterns ...string) ([]*packages.Package, error)

func (Context) LoadWithoutTests added in v0.4.2

func (ctx Context) LoadWithoutTests(patterns ...string) ([]*packages.Package, error)

func (*Context) Set

func (ctx *Context) Set(key, value string)

type Set

type Set map[string]*packages.Package

Set is a p.ID -> *packages.Package

func Calc

func Calc(parentContext context.Context, expr []string) (Set, error)

Calc parses expr and computes the set of packages it describes.

func DirectDependencies

func DirectDependencies(a Set) Set

DirectDependencies returns packages that are direct dependencies of a, `a` not included.

func Incoming

func Incoming(a, b Set) Set

Incoming returns packages from a that directly import packages in b.

func Intersect

func Intersect(a, b Set) Set

Intersect returns packages that exist in both

func Main

func Main(a Set) Set

Main returns main pacakges.

func New

func New(roots ...*packages.Package) Set

New makes a set from roots recursively

func NewAll

func NewAll(src Set) Set

NewAll includes all the dependencies from the graph.

func NewRoot

func NewRoot(roots ...*packages.Package) Set

NewRoot makes a set from roots recursively

func Reach

func Reach(a, b Set) Set

Reach returns packages in a that terminate in b

func Sources

func Sources(a Set) Set

Sources returns packages that don't have incoming edges

func Std

func Std() Set

Std returns the standard package set

func Subtract

func Subtract(a, b Set) Set

Subtract returns packages that exist in a, but not in b

func SymmetricDifference

func SymmetricDifference(a, b Set) Set

SymmetricDifference returns packages that are different

func Test added in v0.4.2

func Test(a Set) Set

Test returns test packages from set.

func Transitive

func Transitive(a Set) Set

Transitive returns transitive reduction.

func Union

func Union(a, b Set) Set

Union includes packages from both sets

func (Set) Clone

func (set Set) Clone() Set

Clone makes a copy of the set

func (Set) IDs added in v0.4.2

func (set Set) IDs() []string

IDs returns package ID-s in sorted order.

func (Set) IncludeRecursive

func (set Set) IncludeRecursive(p *packages.Package)

IncludeRecursive adds p recursively

func (Set) List

func (set Set) List() []*packages.Package

List returns packages in unsorted order.

func (Set) Sorted

func (set Set) Sorted() []*packages.Package

Sorted returns packages in sorted order

func (Set) Walk

func (set Set) Walk(fn func(*packages.Package))

func (Set) WalkDependencies

func (set Set) WalkDependencies(fn func(*packages.Package))

type Strings

type Strings []string

func (Strings) Clone

func (strs Strings) Clone() Strings

func (Strings) IndexOf

func (strs Strings) IndexOf(key string) int

func (*Strings) Set

func (strs *Strings) Set(key, value string)

func (Strings) ValueOf

func (strs Strings) ValueOf(key string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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