Skip to content

azylman/govend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Govend

Command govend helps build packages reproducibly by fixing their dependencies.

This tool assumes you are working in a standard Go workspace, as described in http://golang.org/doc/code.html. We require Go 1.5 or newer to build govend itself, and you can only use it with go 1.5 and newer.

NOTE: This is currently very alpha. I wrote it at GopherCon and haven't used it very much yet.

Install

$ go get github.com/azylman/govend

Getting Started

How to add govend in a new project.

Assuming you've got everything working already (i.e. you can build your project with go install and test it with go test), it's one command to start using:

$ govend

This will save a list of dependencies to the file vendor/Deps.json, and copy their source code into vendor/. Read over its contents and make sure it looks reasonable. Then commit the whole vendor directory to version control.

Add a Dependency

To add a new package foo/bar, do this:

  1. Edit your code to import foo/bar.
  2. Run govend.

Update a Dependency

To update a package, do this:

  1. Run govend -u foo/bar.

You can use the ... wildcard, for example govend -u foo/.... You can also use ./... to update everything, govend -u ./.... This is the default if no arguments are provided.

File Format

Deps is a json file with the following structure:

type Deps struct {
	ImportPath string
	GoVersion  string   // Abridged output of 'go version'.
	Deps       []struct {
		ImportPath string
		Comment    string // Description of commit, if present.
		Rev        string // VCS-specific commit ID.
	}
}

Example Deps:

{
	"ImportPath": "github.com/kr/hk",
	"GoVersion": "go1.1.2",
	"Deps": [
		{
			"ImportPath": "code.google.com/p/go-netrc/netrc",
			"Rev": "28676070ab99"
		},
		{
			"ImportPath": "github.com/kr/binarydist",
			"Rev": "3380ade90f8b0dfa3e363fd7d7e941fa857d0d13"
		}
	]
}

Acknowledgements

Heavily inspired by godep. The subpackages in this repository are made from godep code, refactored into a package.

About

Go vendoring management for go1.5 vendoring formats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages