vendor

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2015 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copypath

func Copypath(dst string, src string) error

Copypath copies the contents of src to dst, excluding any file or directory that starts with a period.

func FetchMetadata

func FetchMetadata(path string, insecure bool) (rc io.ReadCloser, err error)

FetchMetadata fetchs the remote metadata for path.

func LoadPaths

func LoadPaths(paths ...struct{ Root, Prefix string }) (map[string]*Depset, error)

LoadPaths returns a map of paths to Depsets.

func ParseImports

func ParseImports(root string) (map[string]bool, error)

ParseImports parses Go packages from a specific root returning a set of import paths.

func ParseMetadata

func ParseMetadata(path string, insecure bool) (string, string, string, error)

ParseMetadata fetchs and decodes remote metadata for path.

func RemoveAll

func RemoveAll(path string) error

RemoveAll removes path and any children it contains. Unlike os.RemoveAll it deletes read only files on Windows.

func WriteManifest

func WriteManifest(path string, m *Manifest) error

WriteManifest writes a Manifest to the path. If the manifest does not exist, it is created. If it does exist, it will be overwritten. If the manifest file is empty (0 dependencies) it will be deleted. The dependencies will be ordered by import path to reduce churn when making changes. TODO(dfc) write to temporary file and move atomically to avoid destroying a working vendorfile.

Types

type BzrClone

type BzrClone struct {
	// contains filtered or unexported fields
}

BzrClone is a bazaar WorkingCopy.

func (*BzrClone) Branch

func (b *BzrClone) Branch() (string, error)

func (BzrClone) Destroy

func (w BzrClone) Destroy() error

func (BzrClone) Dir

func (w BzrClone) Dir() string

func (*BzrClone) Revision

func (b *BzrClone) Revision() (string, error)

type Dependency

type Dependency struct {
	// Importpath is name by which this dependency is known.
	Importpath string `json:"importpath"`

	// Repository is the remote DVCS location that this
	// dependency was fetched from.
	Repository string `json:"repository"`

	// Revision is the revision that describes the dependency's
	// remote revision.
	Revision string `json:"revision"`

	// Branch is the branch the Revision was located on.
	// Can be blank if not needed.
	Branch string `json:"branch"`

	// Path is the path inside the Repository where the
	// dependency was fetched from.
	Path string `json:"path,omitempty"`
}

Dependency describes one vendored import path of code A Dependency is an Importpath sources from a Respository at Revision from Path.

type Depset

type Depset struct {
	Root   string
	Prefix string
	Pkgs   map[string]*Pkg
}

Depset describes a set of related Go packages.

func LoadTree

func LoadTree(root string, prefix string) (*Depset, error)

LoadTree parses a tree of source files into a map of *pkgs.

type GitClone

type GitClone struct {
	// contains filtered or unexported fields
}

GitClone is a git WorkingCopy.

func (*GitClone) Branch

func (g *GitClone) Branch() (string, error)

func (GitClone) Destroy

func (w GitClone) Destroy() error

func (GitClone) Dir

func (w GitClone) Dir() string

func (*GitClone) Revision

func (g *GitClone) Revision() (string, error)

type HgClone

type HgClone struct {
	// contains filtered or unexported fields
}

HgClone is a mercurial WorkingCopy.

func (*HgClone) Branch

func (h *HgClone) Branch() (string, error)

func (HgClone) Destroy

func (w HgClone) Destroy() error

func (HgClone) Dir

func (w HgClone) Dir() string

func (*HgClone) Revision

func (h *HgClone) Revision() (string, error)

type Manifest

type Manifest struct {
	// Manifest version. Current manifest version is 0.
	Version int `json:"version"`

	// Depenencies is a list of vendored dependencies.
	Dependencies []Dependency `json:"dependencies"`
}

Manifest describes the layout of $PROJECT/vendor/manifest.

func ReadManifest

func ReadManifest(path string) (*Manifest, error)

ReadManifest reads a Manifest from path. If the Manifest is not found, a blank Manifest will be returned.

func (*Manifest) AddDependency

func (m *Manifest) AddDependency(dep Dependency) error

AddDependency adds a Dependency to the current Manifest. If the dependency exists already then it returns and error.

func (*Manifest) GetDependencyForImportpath

func (m *Manifest) GetDependencyForImportpath(path string) (Dependency, error)

GetDependencyForRepository return a dependency for specified URL If the dependency does not exist it returns an error

func (*Manifest) HasImportpath

func (m *Manifest) HasImportpath(path string) bool

HasImportpath reports whether the Manifest contains the import path.

func (*Manifest) RemoveDependency

func (m *Manifest) RemoveDependency(dep Dependency) error

RemoveDependency removes a Dependency from the current Manifest. If the dependency does not exist then it returns an error.

type Pkg

type Pkg struct {
	*Depset
	*build.Package
}

Pkg describes a Go package.

type RemoteRepo

type RemoteRepo interface {

	// Checkout checks out a specific branch, tag, or revision.
	// The interpretation of these three values is impementation
	// specific.
	Checkout(branch, tag, revision string) (WorkingCopy, error)

	// URL returns the URL the clone was taken from. It should
	// only be called after Clone.
	URL() string
}

RemoteRepo describes a remote dvcs repository.

func Bzrrepo

func Bzrrepo(url string) (RemoteRepo, error)

Bzrrepo returns a RemoteRepo representing a remote bzr repository.

func DeduceRemoteRepo

func DeduceRemoteRepo(path string, insecure bool) (RemoteRepo, string, error)

DeduceRemoteRepo takes a potential import path and returns a RemoteRepo representing the remote location of the source of an import path. Remote repositories can be bare import paths, or urls including a checkout scheme. If deduction would cause traversal of an insecure host, a message will be printed and the travelsal path will be ignored.

func Gitrepo

func Gitrepo(url *url.URL, insecure bool, schemes ...string) (RemoteRepo, error)

Gitrepo returns a RemoteRepo representing a remote git repository.

func Hgrepo

func Hgrepo(u *url.URL, insecure bool, schemes ...string) (RemoteRepo, error)

Hgrepo returns a RemoteRepo representing a remote git repository.

type WorkingCopy

type WorkingCopy interface {

	// Dir is the root of this working copy.
	Dir() string

	// Revision returns the revision of this working copy.
	Revision() (string, error)

	// Branch returns the branch to which this working copy belongs.
	Branch() (string, error)

	// Destroy removes the working copy and cleans path to the working copy.
	Destroy() error
}

WorkingCopy represents a local copy of a remote dvcs repository.

Jump to

Keyboard shortcuts

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