Updated CONTRIBUTING.md to have up-to-date information about building with Go

This commit is contained in:
Chris Bednarski 2016-02-05 13:43:18 -08:00
parent c10e0eb398
commit ad5416e2e3
1 changed files with 20 additions and 20 deletions

View File

@ -53,35 +53,35 @@ it raises the chances we can quickly merge or address your contributions.
If you have never worked with Go before, you will have to complete the If you have never worked with Go before, you will have to complete the
following steps in order to be able to compile and test Packer. following steps in order to be able to compile and test Packer.
1. Install Go. Make sure the Go version is at least Go 1.4. Packer will not work with anything less than 1. [Download](https://golang.org/dl) and install Go. Make sure your Go version
Go 1.4. On a Mac, you can `brew install go` to install Go 1.4. is at least Go 1.5. Packer _may_ work with older versions of Go but these
are not supported.
2. Set and export the `GOPATH` environment variable and update your `PATH`. 2. Set and export the `GOPATH` environment variable and update your `PATH`. For
For example, you can add to your `.bash_profile`. example, you can add to your `.bash_profile`. If you're using Go 1.5 also
set `GO15VENDOREXPERIMENT`. This is not necessary for Go 1.6 and up.
``` ```
export GOPATH=$HOME/Documents/golang export GOPATH=$HOME/Documents/golang
export GO15VENDOREXPERIMENT=1
export PATH=$PATH:$GOPATH/bin export PATH=$PATH:$GOPATH/bin
``` ```
3. Install and build `gox` with 3. Download the Packer source (and its dependencies) by running `go get
github.com/mitchellh/packer`. This will download the Packer source to
`$GOPATH/src/github.com/mitchellh/packer`.
``` 4. When working on packer `cd $GOPATH/src/github.com/mitchellh/packer` so you
go get github.com/mitchellh/gox can run make and easily access other files.
cd $GOPATH/src/github.com/mitchellh/gox
go build
```
4. Download the Packer source (and its dependencies) by running 5. Make your changes to the Packer source. You can run `make` in
`go get github.com/mitchellh/packer`. This will download the Packer `$GOPATH/src/github.com/mitchellh/packer` to run tests and build the packer
source to `$GOPATH/src/github.com/mitchellh/packer`. binary. Any compilation errors will be shown when the binaries are
rebuilding.
5. Make your changes to the Packer source. You can run `make` from the main 6. After running `make` successfully, use
source directory to recompile all the binaries. Any compilation errors `$GOPATH/src/github.com/mitchellh/packer/bin/packer` to build a machine and
will be shown when the binaries are rebuilding. verify your changes work.
6. Test your changes by running `make test` and then running
`$GOPATH/src/github.com/mitchellh/packer/bin/packer` to build a machine.
7. If everything works well and the tests pass, run `go fmt` on your code 7. If everything works well and the tests pass, run `go fmt` on your code
before submitting a pull request. before submitting a pull-request.