diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c22520ae6..be9daaa19 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,27 +8,20 @@ From `$GOPATH/src/github.com/aws/amazon-ecs-cli`: * Run `make` (This creates a standalone executable in the `bin/local` directory). From `$GOPATH/src/github.com/aws/amazon-ecs-cli/ecs-cli`: -* Run `godep restore` (This will download and install dependencies specified in the `Godeps/Godeps.json` into your `$GOPATH`). -* **NOTE:** `godep restore` puts the dependencies in a detached HEAD state (see: [Updating an existing dependency](https://github.com/aws/amazon-ecs-cli/blob/master/README.md#updating-an-existing-dependency)). - -### Adding new dependencies -* Make sure you have the latest [godep](https://github.com/tools/godep) (`go get -u github.com/tools/godep`) (version 79) -* `go get` the new dependency. -* Edit your application's source code to import the new dependency. -* From `$GOPATH/src/github.com/aws/amazon-ecs-cli/ecs-cli`, run `godep save ./...` (This will update `Godeps/Godeps.json` and copy the dependencies source to the `vendor/` directory). - -### Updating an existing dependency -* While godep recommends using `godep update`, this command unfortunately has several known issues (See: https://github.com/tools/godep/issues/498). We recommend following their [suggestion](https://github.com/tools/godep/issues/498#issuecomment-238946586): - 1. Delete any reference to the package in `Godeps/Godeps.json` (you can also delete the entire `Godeps` dir). - 1. Delete the package from the `/vendor` dir: `rm -rf $GOPATH/src/github.com/aws/amazon-ecs-cli/ecs-cli/vendor/`. (You can also delete the entire vendor dir) - 1. Re-vendor the dependency by running `godep save ./...` from `$GOPATH/src/github.com/aws/amazon-ecs-cli/ecs-cli`. - -* Inspect the changes with `git diff` (should show up in `vendor/` directory) -* Example: https://github.com/aws/amazon-ecs-cli/pull/315 -* **NOTE:** Unfortunately, using `godep restore` means that `go get` will not work with dependencies. Until we move off `godep`, when we want to update a dependency we will have to go to the dependency in the `$GOPATH` and manually use `git pull` an update to that package. - -### Generating mocks -* From `$GOPATH/src/github.com/aws/amazon-ecs-cli/`, run `make generate`. This will look for all files named `generate_mock.go` in the `ecs-cli/modules` directory and call the `mockgen.sh` script, which is a wrapper for the [mockgen](https://github.com/golang/mock#running-mockgen) command. +* run `dep ensure`. This will download dependencies specified in the `Gopkg.lock` by default in `$GOPATH/pkg/dep/sources`. +* **NOTE:** `dep ensure` puts the dependencies in a detached HEAD state. + +### Adding/updating new dependencies +* We use [dep](https://github.com/golang/dep) to manage dependencies. Make sure you have the latest [dep](https://github.com/golang/dep) (installation instructions [here](https://golang.github.io/dep/docs/installation.html)). +* To [add a dependency](https://golang.github.io/dep/docs/daily-dep.html#adding-a-new-dependency), run `dep ensure -add `. +* To [update a dependency](https://golang.github.io/dep/docs/daily-dep.html#updating-dependencies), run `dep ensure -update`. + +### Generating mocks/licenses +* From `$GOPATH/src/github.com/aws/amazon-ecs-cli/`, run `make generate`. This + will look for all files named `generate_mock.go` in the `ecs-cli/modules` +directory and call the `scripts/mockgen.sh` script, which is a wrapper for the +[mockgen](https://github.com/golang/mock#running-mockgen) command. +* **NOTE:** `make generate` will also regenerate the license via `scripts/license.sh`. ### Cross-compiling The `make docker-build` target builds standalone amd64 executables for