govend

command module
v0.0.0-...-63c3888 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2015 License: BSD-3-Clause Imports: 17 Imported by: 0

README

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.

Documentation

Overview

Command govend helps build packages reproducibly by fixing their dependencies.

Example Usage

Save currently-used dependencies to file Deps:

$ govend

Build project using saved dependencies:

$ GO15VENDOREXPERIMENT=1 go build

or

$ GO15VENDOREXPERIMENT=1 go install

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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