data

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocMatchStringIndex added in v0.9.7

func DocMatchStringIndex(pkg string, links PatternList) (idx int)

DocMatchStringIndex matches pkg in links and returns its index. Only full matches are returned. If pkg doesn't match, pkg+"/" is tried. -1 is returned for no match.

func PkgForPattern added in v0.9.7

func PkgForPattern(pkg string) string

PkgForPattern returns the (parent) package of the given package pattern. If pkg doesn't contain any wildcard '*' the whole string is returned. Otherwise everything up to the last '/' before the wildcard or the empty string if there is no '/' before it.

func RegexpForPattern added in v0.9.7

func RegexpForPattern(pattern string, allowDollar EnumDollar, maxDollar int,
) (*regexp.Regexp, int, []int, error)

RegexpForPattern converts the given pattern including wildcards and variables into a proper regular expression that can be used for matching.

func TypeFormat

func TypeFormat(t PkgType) string

TypeFormat returns the formatting string associated with package type t ("", "_", "`" or "**").

func TypeLetter

func TypeLetter(t PkgType) rune

TypeLetter returns the type letter associated with package type t ('S', 'T', 'D' or 'G').

Types

type DependencyMap

type DependencyMap map[string]PkgImports

DependencyMap is mapping importing package to imported packages. importingPackageName -> (importedPackageNames -> PkgType) An imported package name could be added multiple times to the same importing package name due to test packages.

func FilterDepMap

func FilterDepMap(allMap DependencyMap, idx int, links PatternList) DependencyMap

FilterDepMap filters allMap to contain only packages matching idx and its transitive dependencies. Entries matching other indices in links are filtered, too.

func (DependencyMap) SortedPkgNames added in v0.9.7

func (dm DependencyMap) SortedPkgNames() []string

SortedPkgNames returns the sorted keys (package names) of the dependency map.

type EnumDollar added in v0.9.7

type EnumDollar int

EnumDollar is an enumeration type for how to hanlde dollars ('$') in patterns.

const (
	EnumDollarNone  EnumDollar = iota // '$' isn't allowed at all
	EnumDollarStar                    // '$' has to be followed by one or two '*'
	EnumDollarDigit                   // '$' has to be followed by a single digit (1-9)
)

internal enum for '$' handling in patterns

type Pattern added in v0.9.7

type Pattern struct {
	Pattern    string
	Regexp     *regexp.Regexp
	DollarIdxs []int
}

Pattern combines the original pattern string with a compiled regular expression ready for efficient evaluation.

type PatternList added in v0.9.7

type PatternList []Pattern

PatternList is a slice of the Pattern type.

func NewSimplePatternList added in v0.9.7

func NewSimplePatternList(patterns []string, key string) (PatternList, error)

NewSimplePatternList returns a PatternList initialized from the given patterns. An error is returned if a pattern isn't valid.

func (PatternList) MatchString added in v0.9.7

func (pl PatternList) MatchString(s string, dollars []string) (atAll, full bool)

MatchString returns true if any of the patterns in the pattern list matches the given string including its dollars and false otherwise. If the full string is matched full will be true and false otherwise.

func (PatternList) MatchStringIndex added in v0.9.7

func (pl PatternList) MatchStringIndex(s string, dollars []string) (idx int, full bool)

MatchStringIndex returns the index of the pattern in the list that matches the given string and an indicator if it was a full match.

func (PatternList) String added in v0.9.7

func (pl PatternList) String() string

String implements Stringer and returns the list of patterns, or "..." if no patterns have been added.

type PkgImports

type PkgImports struct {
	PkgType PkgType
	Imports map[string]PkgType
}

PkgImports contains the package type and the imported internal packages with their types.

type PkgType

type PkgType int

PkgType can be one of: Standard, Tool, DB or God

const (
	TypeStandard PkgType = iota
	TypeTool
	TypeDB
	TypeGod
)

Enum of package types: Standard, Tool, DB and God

Jump to

Keyboard shortcuts

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