pkglib

package module
v0.0.0-...-22c0589 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2014 License: GPL-3.0 Imports: 30 Imported by: 0

README

pkglib

Common base for all packages of GET.

Code tries be keep in sync with behaviour of default Go tools so it just uses their source code. For simplify future merges gocmd-*.go files copypasted from cmd/go sources with main() removed from them. Pkglib exports some private names from cmd/go code.

Note: feature from 1.4 for import comments (see http://golang.org/s/go14customimport) removed yet for build GET on 1.3.

Documentation

Overview

New public functions based on go/cmd

Public access to private functions from go/cmd

Index

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

func DownloadPaths(args []string) []string

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

func ImportPaths(args []string) []string

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

func RunInstall

func RunInstall(cmd *Command, args []string)

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.

func (*Command) Name

func (c *Command) Name() string

Name returns the command's name: the first word in the usage line.

func (*Command) Runnable

func (c *Command) Runnable() bool

Runnable reports whether the command can be run; otherwise it is a documentation pseudo-command such as importpath.

func (*Command) Usage

func (c *Command) Usage()

type CoverVar

type CoverVar struct {
	File string // local file name
	Var  string // name of count struct
}

CoverVar holds the name of the generated coverage variables targeting the named file.

type ImportStack

type ImportStack importStack

Just exported internal type

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

func LoadImport(path string, srcDir string, stk *ImportStack, importPos []token.Position) *Package

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

func RepoRootForImportPath(importPath string) (*RepoRoot, error)

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

func VcsByCmd(cmd string) *VcsCmd

VcsByCmd returns the version control system for the given command name (hg, git, svn, bzr).

func (*VcsCmd) Create

func (v *VcsCmd) Create(dir, repo string) error

Create creates a new copy of repo in dir. The parent of dir must exist; dir must not.

func (*VcsCmd) Download

func (v *VcsCmd) Download(dir string) error

Download downloads any new changes for the repo in dir.

func (*VcsCmd) Ping

func (v *VcsCmd) Ping(scheme, repo string) error

Ping pings to determine scheme to use.

func (*VcsCmd) TagSync

func (v *VcsCmd) TagSync(dir, tag string) error

TagSync syncs the repo in dir to the named tag, which either is a tag returned by tags or is v.tagDefault.

func (*VcsCmd) Tags

func (v *VcsCmd) Tags(dir string) ([]string, error)

Tags returns the list of available tags for the repo in dir.

Jump to

Keyboard shortcuts

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