Documentation
¶
Index ¶
- func DocMatchStringIndex(pkg string, links PatternList) (idx int)
- func PkgForPattern(pkg string) string
- func RegexpForPattern(pattern string, allowDollar EnumDollar, maxDollar int) (*regexp.Regexp, int, []int, error)
- func TypeFormat(t PkgType) string
- func TypeLetter(t PkgType) rune
- type DependencyMap
- type EnumDollar
- type Pattern
- type PatternList
- type PkgImports
- type PkgType
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
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 ¶
TypeFormat returns the formatting string associated with package type t ("", "_", "`" or "**").
func TypeLetter ¶
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
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 ¶
PkgImports contains the package type and the imported internal packages with their types.