path

package
v0.0.0-...-7deada1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package path contains path and environment utilities for Glide.

This includes tools to find and manipulate Go path variables, as well as tools for copying from one path to another.

Index

Constants

View Source
const DefaultGlideFile = "glide.yaml"

DefaultGlideFile is the default name for the glide.yaml file.

View Source
const LockFile = "glide.lock"

LockFile is the default name for the lock file.

Variables

View Source
var GlideFile = DefaultGlideFile

GlideFile is the name of the Glide file.

Setting this is not concurrency safe. For consistency, it should really only be set once, at startup, or not at all.

View Source
var HomeDir = "$HOME/.glide"

HomeDir is the home directory for Glide.

HomeDir is where cache files and other configuration data are stored.

View Source
var VendorDir = "vendor"

VendorDir is the name of the directory that holds vendored dependencies.

As of Go 1.5, this is always vendor.

Functions

func Basepath

func Basepath() string

Basepath returns the current working directory.

If there is an error getting the working directory, this returns ".", which should function in cases where the directory is unlinked... Then again, maybe not.

func CopyDir

func CopyDir(source string, dest string) error

CopyDir copies an entire source directory to the dest directory.

This is akin to `cp -a src/* dest/`

We copy the directory here rather than jumping out to a shell so we can support multiple operating systems.

func CopyFile

func CopyFile(source string, dest string) error

CopyFile copies a source file to a destination.

It follows symbolic links and retains modes.

func Glide

func Glide() (string, error)

Glide gets the path to the closest glide file.

func GlideWD

func GlideWD(dir string) (string, error)

GlideWD finds the working directory of the glide.yaml file, starting at dir.

If the glide file is not found in the current directory, it recurses up a directory.

func Gopath

func Gopath() string

Gopath gets GOPATH from environment and return the most relevant path.

A GOPATH can contain a colon-separated list of paths. This retrieves the GOPATH and returns only the FIRST ("most relevant") path.

This should be used carefully. If, for example, you are looking for a package, you may be better off using Gopaths.

func Gopaths

func Gopaths() []string

Gopaths retrieves the Gopath as a list when there is more than one path listed in the Gopath.

func HasLock

func HasLock(basepath string) bool

HasLock returns true if this can stat a lockfile at the givin location.

func Home

func Home() string

Home returns the Glide home directory ($GLIDE_HOME or ~/.glide, typically).

This normalizes to an absolute path, and passes through os.ExpandEnv.

func IsDirectoryEmpty

func IsDirectoryEmpty(dir string) (bool, error)

IsDirectoryEmpty checks if a directory is empty.

func IsLink(fi os.FileInfo) bool

IsLink returns true if the given FileInfo references a link.

func StripBasepath

func StripBasepath(p string) string

StripBasepath removes the base directory from a passed in path.

func StripVcs

func StripVcs() error

StripVcs removes VCS metadata (.git, .hg, .bzr, .svn) from the vendor/ directory.

func StripVendor

func StripVendor() error

StripVendor removes nested vendor and Godeps/_workspace/ directories.

func Vendor

func Vendor() (string, error)

Vendor calculates the path to the vendor directory.

Based on working directory, VendorDir and GlideFile, this attempts to guess the location of the vendor directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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