dep

package module
v0.0.0-...-0acfd38 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2017 License: BSD-3-Clause Imports: 17 Imported by: 0

README

Dep

Linux & OSX: Build Status | Windows: Build status

Dep is a prototype dependency management tool.

Current status

Pre-alpha. Lots of functionality is knowingly missing or broken. The repository is open to solicit feedback and contributions from the community. Please see below for feedback and contribution guidelines.

Context

Usage

Get the tool via

$ go get github.com/golang/dep/...

Typical usage on a new repo might be

$ dep init
$ dep ensure -update

To update a dependency to a new version, you might run

$ dep ensure github.com/pkg/errors@^0.8.0

See the help text for much more detailed usage instructions.

Note that the manifest and lock file formats are not finalized, and will likely change before the tool is released. We make no compatibility guarantees for the time being. Please don't commit any code or files created with the tool.

Feedback

Feedback is greatly appreciated. At this stage, the maintainers are most interested in feedback centered on the user experience (UX) of the tool. Do you have workflows that the tool supports well, or doesn't support at all? Do any of the commands have surprising effects, output, or results? Please check the existing issues to see if your feedback has already been reported. If not, please file an issue, describing what you did or wanted to do, what you expected to happen, and what actually happened.

Contributing

Contributions are greatly appreciated. The maintainers actively manage the issues list, and try to highlight issues suitable for newcomers. The project follows the typical GitHub pull request model. See CONTRIBUTING.md for more details. Before starting any work, please either comment on an existing issue, or file a new one.

Documentation

Index

Constants

View Source
const LockName = "lock.json"
View Source
const ManifestName = "manifest.json"

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src string, dest string) error

CopyDir takes in a directory and copies its contents to the destination. It preserves the file mode on files as well.

func CopyFile

func CopyFile(src string, dest string) error

CopyFile copies a file from one place to another with the permission bits preserved as well.

func IsDir

func IsDir(name string) (bool, error)

func IsRegular

func IsRegular(name string) (bool, error)

Types

type Ctx

type Ctx struct {
	GOPATH string // Go path
}

Ctx defines the supporting context of the tool.

func NewContext

func NewContext() (*Ctx, error)

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

func (c *Ctx) LoadProject(path string) (*Project, error)

LoadProject searches for a project root from the provided path, then loads the manifest and lock (if any) it finds there.

If the provided path is empty, it will search from the path indicated by os.Getwd().

func (*Ctx) SourceManager

func (c *Ctx) SourceManager() (*gps.SourceMgr, error)

func (*Ctx) SplitAbsoluteProjectRoot

func (c *Ctx) SplitAbsoluteProjectRoot(path string) (string, error)

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

func (c *Ctx) VersionInWorkspace(root gps.ProjectRoot) (gps.Version, error)

type Lock

type Lock struct {
	Memo []byte
	P    []gps.LockedProject
}

func LockFromInterface

func LockFromInterface(in gps.Lock) *Lock

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) InputHash

func (l *Lock) InputHash() []byte

func (*Lock) MarshalJSON

func (l *Lock) MarshalJSON() ([]byte, error)

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 (m *Manifest) IgnoredPackages() map[string]bool

func (*Manifest) MarshalJSON

func (m *Manifest) MarshalJSON() ([]byte, error)

func (*Manifest) Overrides

func (m *Manifest) Overrides() gps.ProjectConstraints

func (*Manifest) RequiredPackages

func (m *Manifest) RequiredPackages() map[string]bool

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)

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.

Jump to

Keyboard shortcuts

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