|
1 |
| -### Install Golang |
| 1 | +# Minio Contribution Guide [](https://slack.minio.io) [](https://goreportcard.com/report/minio/minio) [](https://hub.docker.com/r/minio/minio/) [](https://codecov.io/gh/minio/minio) |
2 | 2 |
|
3 |
| -If you do not have a working Golang environment setup please follow [Golang Installation Guide](https://docs.minio.io/docs/how-to-install-golang). |
| 3 | +``Minio`` community welcomes your contribution. To make the process as seamless as possible, we recommend you read this contribution guide. |
| 4 | + |
| 5 | +## Development Workflow |
| 6 | + |
| 7 | +Start by forking the Minio GitHub repository, make changes in a branch and then send a pull request. We encourage pull requests to discuss code changes. Here are the steps in details: |
4 | 8 |
|
5 | 9 | ### Setup your Minio Github Repository
|
6 |
| -Fork [Minio upstream](https://github.com/minio/minio/fork) source repository to your own personal repository. Copy the URL for minio from your personal github repo (you will need it for the `git clone` command below). |
| 10 | +Fork [Minio upstream](https://github.com/minio/minio/fork) source repository to your own personal repository. Copy the URL of your Minio fork (you will need it for the `git clone` command below). |
| 11 | + |
7 | 12 | ```sh
|
8 | 13 | $ mkdir -p $GOPATH/src/github.com/minio
|
9 | 14 | $ cd $GOPATH/src/github.com/minio
|
10 | 15 | $ git clone <paste saved URL for personal forked minio repo>
|
11 | 16 | $ cd minio
|
12 | 17 | ```
|
13 | 18 |
|
14 |
| -### Compiling Minio from source |
15 |
| -Minio uses ``Makefile`` to wrap around some of redundant checks done through command line. |
16 |
| - |
17 |
| -```sh |
18 |
| -$ make |
19 |
| -Checking if proper environment variables are set.. Done |
20 |
| -... |
21 |
| -Checking dependencies for Minio.. Done |
22 |
| -Installed govet |
23 |
| -Building Libraries |
24 |
| -... |
25 |
| -... |
26 |
| -``` |
27 |
| -
|
28 |
| -### Setting up git remote as ``upstream`` |
| 19 | +### Set up git remote as ``upstream`` |
29 | 20 | ```sh
|
30 | 21 | $ cd $GOPATH/src/github.com/minio/minio
|
31 | 22 | $ git remote add upstream https://github.com/minio/minio
|
32 | 23 | $ git fetch upstream
|
33 | 24 | $ git merge upstream/master
|
34 | 25 | ...
|
35 |
| -... |
36 |
| -$ make |
37 |
| -Checking if proper environment variables are set.. Done |
38 |
| -... |
39 |
| -Checking dependencies for Minio.. Done |
40 |
| -Installed govet |
41 |
| -Building Libraries |
42 |
| -... |
43 | 26 | ```
|
44 | 27 |
|
45 |
| -### Developer Guidelines |
46 |
| -``Minio`` community welcomes your contribution. To make the process as seamless as possible, we ask for the following: |
47 |
| -* Go ahead and fork the project and make your changes. We encourage pull requests to discuss code changes. |
48 |
| - - Fork it |
49 |
| - - Create your feature branch (git checkout -b my-new-feature) |
50 |
| - - Commit your changes (git commit -am 'Add some feature') |
51 |
| - - Push to the branch (git push origin my-new-feature) |
52 |
| - - Create new Pull Request |
53 |
| -
|
54 |
| -* If you have additional dependencies for ``Minio``, ``Minio`` manages its dependencies using [govendor](https://github.com/kardianos/govendor) |
55 |
| - - Run `go get foo/bar` |
56 |
| - - Edit your code to import foo/bar |
57 |
| - - Run `make pkg-add PKG=foo/bar` from top-level directory |
58 |
| -
|
59 |
| -* If you have dependencies for ``Minio`` which needs to be removed |
60 |
| - - Edit your code to not import foo/bar |
61 |
| - - Run `make pkg-remove PKG=foo/bar` from top-level directory |
62 |
| -
|
63 |
| -* When you're ready to create a pull request, be sure to: |
64 |
| - - Have test cases for the new code. If you have questions about how to do it, please ask in your pull request. |
65 |
| - - Run `make verifiers` |
66 |
| - - Squash your commits into a single commit. `git rebase -i`. It's okay to force update your pull request. |
67 |
| - - Make sure `go test -race ./...` and `go build` completes. |
68 |
| -
|
69 |
| -* Read [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project |
70 |
| - - `Minio` project is fully conformant with Golang style |
71 |
| - - if you happen to observe offending code, please feel free to send a pull request |
| 28 | +### Create your feature branch |
| 29 | +Before making code changes, make sure you create a separate branch for these changes |
| 30 | + |
| 31 | +``` |
| 32 | +$ git checkout -b my-new-feature |
| 33 | +``` |
| 34 | + |
| 35 | +### Test Minio server changes |
| 36 | +After your code changes, make sure |
| 37 | + |
| 38 | +- To add test cases for the new code. If you have questions about how to do it, please ask on our [Slack](slack.minio.io) channel. |
| 39 | +- To run `make verifiers` |
| 40 | +- To squash your commits into a single commit. `git rebase -i`. It's okay to force update your pull request. |
| 41 | +- To run `go test -race ./...` and `go build` completes. |
| 42 | + |
| 43 | +### Commit changes |
| 44 | +After verification, commit your changes. This is a [great post](https://chris.beams.io/posts/git-commit/) on how to write useful commit messages |
| 45 | + |
| 46 | +``` |
| 47 | +$ git commit -am 'Add some feature' |
| 48 | +``` |
| 49 | + |
| 50 | +### Push to the branch |
| 51 | +Push your locally committed changes to the remote origin (your fork) |
| 52 | +``` |
| 53 | +$ git push origin my-new-feature |
| 54 | +``` |
| 55 | + |
| 56 | +### Create a Pull Request |
| 57 | +Pull requests can be created via GitHub. Refer to [this document](https://help.github.com/articles/creating-a-pull-request/) for detailed steps on how to create a pull request. After a Pull Request gets peer reviewed and approved, it will be merged. |
| 58 | + |
| 59 | +## FAQs |
| 60 | +### How does ``Minio`` manages dependencies? |
| 61 | +``Minio`` manages its dependencies using [govendor](https://github.com/kardianos/govendor). To add a dependency |
| 62 | +- Run `go get foo/bar` |
| 63 | +- Edit your code to import foo/bar |
| 64 | +- Run `make pkg-add PKG=foo/bar` from top-level directory |
| 65 | + |
| 66 | +To remove a dependency |
| 67 | +- Edit your code to not import foo/bar |
| 68 | +- Run `make pkg-remove PKG=foo/bar` from top-level directory |
| 69 | + |
| 70 | +### What are the coding guidelines for Minio? |
| 71 | +``Minio`` is fully conformant with Golang style. Refer: [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project. If you observe offending code, please feel free to send a pull request or ping us on [Slack](slack.minio.io). |
0 commit comments