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)
- func PruneProject(p *Project, sm gps.SourceManager) error
- type Analyzer
- type Ctx
- type Lock
- type Manifest
- func (m *Manifest) DependencyConstraints() gps.ProjectConstraints
- func (m *Manifest) IgnoredPackages() map[string]bool
- func (m *Manifest) IsEmpty() bool
- func (m *Manifest) MarshalTOML() ([]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 SafeWriterPayload
- type SortedLockedProjects
- type VendorBehavior
Constants ¶
const LockName = "Gopkg.lock"
const ManifestName = "Gopkg.toml"
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 ¶
func PruneProject ¶
func PruneProject(p *Project, sm gps.SourceManager) error
Types ¶
type Ctx ¶
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 (Gopkg.toml, 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) MarshalTOML ¶
func (*Lock) Projects ¶
func (l *Lock) Projects() []gps.LockedProject
type Manifest ¶
type Manifest struct { Dependencies gps.ProjectConstraints Ovr gps.ProjectConstraints Ignored []string Required []string }
func (*Manifest) DependencyConstraints ¶
func (m *Manifest) DependencyConstraints() gps.ProjectConstraints
func (*Manifest) IgnoredPackages ¶
func (*Manifest) MarshalTOML ¶
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 {
Payload *SafeWriterPayload
}
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) Prepare ¶
func (sw *SafeWriter) Prepare(manifest *Manifest, oldLock, newLock *Lock, vendor VendorBehavior) error
Prepare to write a set of config yaml, lock and vendor tree.
- If manifest is provided, it will be written to the standard manifest file name beneath root.
- If newLock is provided, it will be written to the standard lock file name beneath root.
- If vendor is VendorAlways, or is VendorOnChanged and the locks are different, the vendor directory will be written beneath root based on newLock.
- If oldLock is provided without newLock, error.
- If vendor is VendorAlways without a newLock, error.
func (*SafeWriter) PrintPreparedActions ¶
func (sw *SafeWriter) PrintPreparedActions() error
func (*SafeWriter) Write ¶
func (sw *SafeWriter) Write(root string, sm gps.SourceManager) error
Write saves some combination of config yaml, lock, and a vendor tree. root is the absolute path of root dir in which to write. sm is only required if vendor is being written.
It first writes to a temp dir, then moves them in 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.
type SafeWriterPayload ¶
type SafeWriterPayload struct { Manifest *Manifest Lock *Lock LockDiff *gps.LockDiff WriteVendor bool }
SafeWriterPayload represents the actions SafeWriter will execute when SafeWriter.Write is called.
func (*SafeWriterPayload) HasLock ¶
func (payload *SafeWriterPayload) HasLock() bool
func (*SafeWriterPayload) HasManifest ¶
func (payload *SafeWriterPayload) HasManifest() bool
func (*SafeWriterPayload) HasVendor ¶
func (payload *SafeWriterPayload) HasVendor() bool
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)
type VendorBehavior ¶
type VendorBehavior int
VendorBehavior defines when the vendor directory should be written.
const ( // VendorOnChanged indicates that the vendor directory should be written when the lock is new or changed. VendorOnChanged VendorBehavior = iota // VendorAlways forces the vendor directory to always be written. VendorAlways // VendorNever indicates the vendor directory should never be written. VendorNever )
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. |