Development workflow - couchbase/sync_gateway GitHub Wiki
This document is geared towards developers, and there is a bias towards an approach that plays as nicely as possible with editors, IDEs, and other tooling at the expense of a bit of extra effort to verify that builds are stable.
$GOPATH
Install go and setup - Install Go
- Set your
$GOPATH
environment to wherever you want, for example~/Development/gocode
go get
Get the code via go get -u -t github.com/couchbase/sync_gateway/...
Now you have the code and all dependencies in your $GOPATH
Open the code in your editor
Using your favorite editor, open the main.go
file in $GOPATH/src/github.com/couchbase/sync_gateway
and the code in the sub-packages in $GOPATH/src/github.com/couchbase/sync_gateway/base
, etc..
Add/update code and run newly added unit tests
After you've changed the code, run your newly added unit tests:
$ cd $GOPATH/src/github.com/couchbase/sync_gateway
$ go test -v -run YourShinyNewUnitTest
As long as you are adding code and unit tests, repeat this step. Once you're ready to submit a PR, move on.
note: lazy developers can skip the rest of this document and submit a PR based on their changes so far, and depend on the CI system to catch any regressions they've introduced when it runs the full test suite
repo
and modify $GOPATH
Get the code via Create a new directory that is outside of your $GOPATH
, for example ~/Development/sync_gateway
Follow these README instructions
$GOPATH
Copy your changes from your default system You will need to manually sync your changes from your default system $GOPATH
to your $GOPATH
under your ~/Development/sync_gateway
manifest/default.xml
(optional)
Update the If you updated or added any dependencies, you'll need to:
- Add/update dependencies in your current
$GOPATH
- Update the
manifest/default.xml
file to reflect your changes
Run full unit test suite
$ cd $GOPATH/src/github.com/couchbase/sync_gateway
$ go test ./...
There shouldn't be any test failures at this point
Issue a Pull Request
At this point, you can commit to the git repository under ~/Development/sync_gateway
and push to a branch or a personal fork and issue a PR against it.
Testing manifest changes that are on a branch
Instructions for testing that this change didn't break anything by running with the manifest from this PR:
- Follow README instructions for doing a repo based build
pushd godeps/src/github.com/couchbase/sync_gateway/
git checkout -t remotes/couchbase/feature/YOUR_FEATURE_BRANCH
cp manifest/default.xml ~/Development/sync_gateway/.repo/manifest.xml
(may need to change path based on where you did repo init)git checkout master
popd
repo sync
GOPATH=
pwd/godeps go test github.com/couchbase/sync_gateway/...