search

package
Version: v0.0.0-...-a371bc2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPackages

func AllPackages(pattern string) []string

AllPackages returns all the packages that can be found under the $GOPATH directories and $GOROOT matching pattern. The pattern is either "all" (all packages), "std" (standard packages), "cmd" (standard commands), or a path including "...".

func AllPackagesInFS

func AllPackagesInFS(pattern string) []string

AllPackagesInFS is like allPackages but is passed a pattern beginning ./ or ../, meaning it should scan the tree rooted at the given directory. There are ... in the pattern too.

func CleanImportPaths

func CleanImportPaths(args []string) []string

CleanImportPaths returns the import paths to use for the given command line, but it does no wildcard expansion.

func ImportPaths

func ImportPaths(args []string) []string

ImportPaths returns the import paths to use for the given command line.

func ImportPathsNoDotExpansion

func ImportPathsNoDotExpansion(args []string) []string

ImportPathsNoDotExpansion returns the import paths to use for the given command line, but it does no ... expansion. TODO(rsc): Delete once old go get is gone.

func IsMetaPackage

func IsMetaPackage(name string) bool

IsMetaPackage checks if name is a reserved package name that expands to multiple packages.

func IsRelativePath

func IsRelativePath(pattern string) bool

IsRelativePath reports whether pattern should be interpreted as a directory path relative to the current directory, as opposed to a pattern matching import paths.

func IsStandardImportPath

func IsStandardImportPath(path string) bool

IsStandardImportPath reports whether $GOROOT/src/path should be considered part of the standard distribution. For historical reasons we allow people to add their own code to $GOROOT instead of using $GOPATH, but we assume that code will start with a domain name (dot in the first element).

Note that this function is meant to evaluate whether a directory found in GOROOT should be treated as part of the standard library. It should not be used to decide that a directory found in GOPATH should be rejected: directories in GOPATH need not have dots in the first element, and they just take their chances with future collisions in the standard library.

func MatchPackages

func MatchPackages(pattern string) []string

MatchPackages returns a list of package paths matching pattern (see go help packages for pattern syntax).

func MatchPackagesInFS

func MatchPackagesInFS(pattern string) []string

MatchPackagesInFS returns a list of package paths matching pattern, which must begin with ./ or ../ (see go help packages for pattern syntax).

func MatchPattern

func MatchPattern(pattern string) func(name string) bool

MatchPattern(pattern)(name) reports whether name matches pattern. Pattern is a limited glob pattern in which '...' means 'any string' and there is no other special syntax. Unfortunately, there are two special cases. Quoting "go help packages":

First, /... at the end of the pattern can match an empty string, so that net/... matches both net and packages in its subdirectories, like net/http. Second, any slash-separted pattern element containing a wildcard never participates in a match of the "vendor" element in the path of a vendored package, so that ./... does not match packages in subdirectories of ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do. Note, however, that a directory named vendor that itself contains code is not a vendored package: cmd/vendor would be a command named vendor, and the pattern cmd/... matches it.

func SetModRoot

func SetModRoot(dir string)

func TreeCanMatchPattern

func TreeCanMatchPattern(pattern string) func(name string) bool

TreeCanMatchPattern(pattern)(name) reports whether name or children of name can possibly match pattern. Pattern is the same limited glob accepted by matchPattern.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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