Documentation ¶
Index ¶
- Constants
- func CopyDir(src string, dest string) error
- func CopyFile(src string, dest string) error
- func IsDir(name string) (bool, error)
- func IsNonEmptyDir(name string) (bool, error)
- func IsRegular(name string) (bool, error)
- type Ctx
- type Lock
- type Manifest
- func (m *Manifest) DependencyConstraints() gps.ProjectConstraints
- func (m *Manifest) IgnoredPackages() map[string]bool
- func (m *Manifest) MarshalJSON() ([]byte, error)
- func (m *Manifest) Overrides() gps.ProjectConstraints
- func (m *Manifest) RequiredPackages() map[string]bool
- func (m *Manifest) TestDependencyConstraints() gps.ProjectConstraints
- type Project
- type SafeWriter
- type SortedLockedProjects
Constants ¶
const LockName = "lock.json"
const ManifestName = "manifest.json"
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir takes in a directory and copies its contents to the destination. It preserves the file mode on files as well.
func CopyFile ¶
CopyFile copies a file from one place to another with the permission bits preserved as well.
func IsNonEmptyDir ¶
Types ¶
type Ctx ¶
type Ctx struct {
GOPATH string // Go path
}
Ctx defines the supporting context of the tool.
func NewContext ¶
NewContext creates a struct with the project's GOPATH. It assumes that of your "GOPATH"'s we want the one we are currently in.
func (*Ctx) LoadProject ¶
LoadProject takes a path and searches up the directory tree for a project root. If an absolute path is given, the search begins in that directory. If a relative or empty path is given, the search start is computed from the current working directory. The search stops when a file with the name ManifestName (manifest.json, by default) is located.
The Project contains the parsed manifest as well as a parsed lock file, if present. The import path is calculated as the remaining path segment below Ctx.GOPATH/src.
func (*Ctx) SplitAbsoluteProjectRoot ¶
SplitAbsoluteProjectRoot takes an absolute path and compares it against declared GOPATH(s) to determine what portion of the input path should be treated as an import path - as a project root.
The second returned string indicates which GOPATH value was used.
func (*Ctx) VersionInWorkspace ¶
type Lock ¶
type Lock struct { Memo []byte P []gps.LockedProject }
func LockFromInterface ¶
LockFromInterface converts an arbitrary gps.Lock to dep's representation of a lock. If the input is already dep's *lock, the input is returned directly.
Data is defensively copied wherever necessary to ensure the resulting *lock shares no memory with the original lock.
As gps.Solution is a superset of gps.Lock, this can also be used to convert solutions to dep's lock format.
func (*Lock) MarshalJSON ¶
func (*Lock) Projects ¶
func (l *Lock) Projects() []gps.LockedProject
type Manifest ¶
type Manifest struct { Dependencies gps.ProjectConstraints Ovr gps.ProjectConstraints Ignores []string Required []string }
func (*Manifest) DependencyConstraints ¶
func (m *Manifest) DependencyConstraints() gps.ProjectConstraints
func (*Manifest) IgnoredPackages ¶
func (*Manifest) MarshalJSON ¶
func (*Manifest) Overrides ¶
func (m *Manifest) Overrides() gps.ProjectConstraints
func (*Manifest) RequiredPackages ¶
func (*Manifest) TestDependencyConstraints ¶
func (m *Manifest) TestDependencyConstraints() gps.ProjectConstraints
type Project ¶
type Project struct { // AbsRoot is the absolute path to the root directory of the project. AbsRoot string // ImportRoot is the import path of the project's root directory. ImportRoot gps.ProjectRoot Manifest *Manifest Lock *Lock }
func (*Project) MakeParams ¶
func (p *Project) MakeParams() gps.SolveParameters
MakeParams is a simple helper to create a gps.SolveParameters without setting any nils incorrectly.
type SafeWriter ¶
type SafeWriter struct { Root string // absolute path of root dir in which to write Manifest *Manifest // the manifest to write, if any Lock *Lock // the old lock, if any NewLock gps.Lock // the new lock, if any SourceManager gps.SourceManager }
SafeWriter transactionalizes writes of manifest, lock, and vendor dir, both individually and in any combination, into a pseudo-atomic action with transactional rollback.
It is not impervious to errors (writing to disk is hard), but it should guard against non-arcane failure conditions.
func (SafeWriter) WriteAllSafe ¶
func (sw SafeWriter) WriteAllSafe(forceVendor bool) error
WriteAllSafe writes out some combination of config yaml, lock, and a vendor tree, to a temp dir, then moves them into place if and only if all the write operations succeeded. It also does its best to roll back if any moves fail.
This mostly guarantees that dep cannot exit with a partial write that would leave an undefined state on disk.
- If a sw.Manifest is provided, it will be written to the standard manifest file name beneath sw.Root
- If sw.Lock is provided without an sw.NewLock, it will be written to the standard lock file name in the root dir, but vendor will NOT be written
- If sw.Lock and sw.NewLock are both provided and are equivalent, then neither lock nor vendor will be written
- If sw.Lock and sw.NewLock are both provided and are not equivalent, the nl will be written to the same location as above, and a vendor tree will be written to sw.Root/vendor
- If sw.NewLock is provided and sw.Lockock is not, it will write both a lock and vendor dir in the same way
- If the forceVendor param is true, then vendor will be unconditionally written out based on sw.NewLock if present, else sw.Lock, else error.
Any of m, l, or nl can be omitted; the grouped write operation will continue for whichever inputs are present. A SourceManager is only required if vendor is being written.
type SortedLockedProjects ¶
type SortedLockedProjects []gps.LockedProject
func (SortedLockedProjects) Len ¶
func (s SortedLockedProjects) Len() int
func (SortedLockedProjects) Less ¶
func (s SortedLockedProjects) Less(i, j int) bool
func (SortedLockedProjects) Swap ¶
func (s SortedLockedProjects) Swap(i, j int)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
dep
Command dep is a prototype dependency management tool.
|
Command dep is a prototype dependency management tool. |
hack
|
|
licenseok
Checks if all files have the license header, a lot of this is based off https://github.com/google/addlicense.
|
Checks if all files have the license header, a lot of this is based off https://github.com/google/addlicense. |