Permalink
Newer
Older
100644 63 lines (40 sloc) 2.88 KB
1
# Contributing to Cockroach
2
3
### Getting and building
4
5
### Assumed
6
* A working GCC (on mac os x something like `xcode-select --install` will get you started)
7
* [Go environment](http://golang.org/doc/code.html)
8
* Git and Mercurial (for retrieving dependencies)
9
10
If you're on Mac OS X, [homebrew](http://brew.sh/) can be very helpful to fulfill these dependencies.
11
12
You can `go get -d github.com/cockroachdb/cockroach` or, alternatively,
14
```bash
Andrew Bonventre
Sep 7, 2014
15
mkdir -p $GOPATH/src/github.com/cockroachdb/
16
cd $GOPATH/src/github.com/cockroachdb/
17
git clone git@github.com:cockroachdb/cockroach.git
18
cd cockroach
19
```
20
21
Now you should be all set for `make build`, `make test` and everything else our Makefile has to
22
offer. Note that the first time you run `make` various dependent libraries and tools will be
23
downloaded and installed which can be somewhat time consuming. Be patient.
25
Note that if you edit a `.proto` file you will need to manually regenerate the associated
26
`.pb.{go,cc,h}` files using `go generate`.
27
28
To add or update a dependency, use `go get -u` and then
29
`glock save github.com/cockroachdb/cockroach` and commit the changes to the GLOCKFILE.
30
31
### Style guide
32
We're following the [Google Go Code Review](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) fairly closely. In particular, you want to watch out for proper punctuation and capitalization and make sure that your lines stay well below 80 characters.
33
Andrew Bonventre
Sep 7, 2014
34
### Code review workflow
Sep 10, 2014
36
+ Create a local feature branch to do work on, ideally on one thing at a time.
37
If you are working on your own fork, see
38
[this tip](http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html)
39
on forking in Go, which ensures that Go import paths will be correct.
Andrew Bonventre
Sep 7, 2014
41
`git checkout -b andybons/update-readme`
42
Andrew Bonventre
Sep 7, 2014
43
+ Hack away and commit your changes locally using `git add` and `git commit`.
44
Andrew Bonventre
Sep 7, 2014
45
`git commit -a -m 'update CONTRIBUTING.md'`
46
Sep 10, 2014
47
+ When you’re ready for review, create a remote branch from your local branch. You may want to `git fetch origin` and run `git rebase origin/master` on your local feature branch before.
48
Andrew Bonventre
Sep 7, 2014
49
`git push -u origin andybons/update-readme`
50
Andrew Bonventre
Sep 7, 2014
51
+ Then [create a pull request using GitHub’s UI](https://help.github.com/articles/creating-a-pull-request).
Sep 10, 2014
52
53
+ Address feedback in new commits. Wait (or ask) for new feedback on those commits if they are not straightforward.
54
55
+ Once ready to land your change, squash your commits. Where n is the number of commits in your branch, run
56
`git rebase -i HEAD~n`
57
58
and subsequently update your remote (you will have to force the push, `git push -f andybons mybranch`). The pull request will update.
59
60
+ If you do not have write access to the repository and your pull request requires a manual merge, you may be asked to rebase again,
61
`git fetch origin; git rebase -i origin/master` and update the PR again. Otherwise, you are free to merge your branch into origin/master directly or rebase first as you deem appropriate.
62