Documentation ¶
Overview ¶
New public functions based on go/cmd
Public access to private functions from go/cmd
Index ¶
- func CleanPackageCache()
- func Download(arg string, stk *ImportStack, getTestDeps bool)
- func DownloadPaths(args []string) []string
- func ImportPaths(args []string) []string
- func RunInstall(cmd *Command, args []string)
- type Command
- type CoverVar
- type ImportStack
- type Package
- type PackageError
- type RepoRoot
- type VcsCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanPackageCache ¶
func CleanPackageCache()
Code we downloaded and all code that depends on it needs to be evicted from the package cache so that the information will be recomputed. Instead of keeping track of the reverse dependency information, evict everything.
func Download ¶
func Download(arg string, stk *ImportStack, getTestDeps bool)
download runs the download half of the get command for the package named by the argument.
func DownloadPaths ¶
DownloadPaths prepares the list of paths to pass to download. It expands ... patterns that can be expanded. If there is no match for a particular pattern, downloadPaths leaves it in the result list, in the hope that we can figure out the repository from the initial ...-free prefix.
func ImportPaths ¶
ImportPaths returns the import paths to use for the given command line.
func RunInstall ¶
Types ¶
type Command ¶
type Command struct { // Run runs the command. // The args are the arguments after the command name. Run func(cmd *Command, args []string) // UsageLine is the one-line usage message. // The first word in the line is taken to be the command name. UsageLine string // Short is the short description shown in the 'go help' output. Short string // Long is the long message shown in the 'go help <this-command>' output. Long string // Flag is a set of flags specific to this command. Flag flag.FlagSet // CustomFlags indicates that the command will do its own // flag parsing. CustomFlags bool }
A Command is an implementation of a go command like go build or go fix.
type CoverVar ¶
CoverVar holds the name of the generated coverage variables targeting the named file.
type Package ¶
type Package struct { // Note: These fields are part of the go command's public API. // See list.go. It is okay to add fields, but not to change or // remove existing ones. Keep in sync with list.go Dir string `json:",omitempty"` // directory containing package sources ImportPath string `json:",omitempty"` // import path of package in dir ImportComment string `json:",omitempty"` // path in import comment on package statement Name string `json:",omitempty"` // package name Doc string `json:",omitempty"` // package documentation string Target string `json:",omitempty"` // install path Goroot bool `json:",omitempty"` // is this package found in the Go root? Standard bool `json:",omitempty"` // is this package part of the standard Go library? Stale bool `json:",omitempty"` // would 'go install' do anything for this package? Root string `json:",omitempty"` // Go root or Go path dir containing this package ConflictDir string `json:",omitempty"` // Dir is hidden by this other directory // Source files GoFiles []string `json:",omitempty"` // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) CgoFiles []string `json:",omitempty"` // .go sources files that import "C" IgnoredGoFiles []string `json:",omitempty"` // .go sources ignored due to build constraints CFiles []string `json:",omitempty"` // .c source files CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files MFiles []string `json:",omitempty"` // .m source files HFiles []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files SFiles []string `json:",omitempty"` // .s source files SwigFiles []string `json:",omitempty"` // .swig files SwigCXXFiles []string `json:",omitempty"` // .swigcxx files SysoFiles []string `json:",omitempty"` // .syso system object files added to package // Cgo directives CgoCFLAGS []string `json:",omitempty"` // cgo: flags for C compiler CgoCPPFLAGS []string `json:",omitempty"` // cgo: flags for C preprocessor CgoCXXFLAGS []string `json:",omitempty"` // cgo: flags for C++ compiler CgoLDFLAGS []string `json:",omitempty"` // cgo: flags for linker CgoPkgConfig []string `json:",omitempty"` // cgo: pkg-config names // Dependency information Imports []string `json:",omitempty"` // import paths used by this package Deps []string `json:",omitempty"` // all (recursively) imported dependencies // Error information Incomplete bool `json:",omitempty"` // was there an error loading this package or dependencies? Error *PackageError `json:",omitempty"` // error loading this package (not dependencies) DepsErrors []*PackageError `json:",omitempty"` // errors loading dependencies // Test information TestGoFiles []string `json:",omitempty"` // _test.go files in package TestImports []string `json:",omitempty"` // imports from TestGoFiles XTestGoFiles []string `json:",omitempty"` // _test.go files outside package XTestImports []string `json:",omitempty"` // imports from XTestGoFiles // contains filtered or unexported fields }
A Package describes a single package found in a directory.
func LoadImport ¶
LoadImport scans the directory named by path, which must be an import path, but possibly a local import path (an absolute file system path or one beginning with ./ or ../). A local relative path is interpreted relative to srcDir. It returns a *Package describing the package found in that directory.
type PackageError ¶
type PackageError struct { ImportStack []string // shortest path from package named on command line to this one Pos string // position of error Err string // the error itself // contains filtered or unexported fields }
A PackageError describes an error loading information about a package.
func (*PackageError) Error ¶
func (p *PackageError) Error() string
type RepoRoot ¶
type RepoRoot struct { Vcs *VcsCmd // repo is the repository URL, including scheme Repo string // root is the import path corresponding to the root of the // repository Root string }
repoRoot represents a version control system, a repo, and a root of where to put it on disk.
func RepoRootForImportPath ¶
RepoRootForImportPath analyzes importPath to determine the version control system, and code repository to use.
type VcsCmd ¶
type VcsCmd vcsCmd
Just exported internal type
func VcsByCmd ¶
VcsByCmd returns the version control system for the given command name (hg, git, svn, bzr).
func (*VcsCmd) Create ¶
Create creates a new copy of repo in dir. The parent of dir must exist; dir must not.