Documentation ¶
Overview ¶
Copyright 2022 tobbstr. All rights reserved. Use of this source code is governed by a MIT- license that can be found in the LICENSE file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a tree builder. A Builder should not be reused for different trees, instead a new Builder should be instantiated.
func (*Builder) Build ¶
Build builds and returns a doubly-linked tree of import paths, so it's possible to see which packages are imported by a package (its children) and also which packages import a package (its parents). The tree's root package is given by importPath. Only packages matched by matchPkg are included in the tree.
Ex.
builder.Build("github.com/johndoe/example/cmd/acme", func(pkg *package.Package) bool{ // includes only packages belonging to the same module if strings.Contains(pkg.PkgPath, "github.com/johndoe/example") { return true } return false })
type MatchPkg ¶
MatchPkg is a predicate function for selecting which Go packages to include in the tree