| 
									
										
										
										
											2017-06-03 08:26:51 +01:00
										 |  |  |  | # Contributing to CoreDNS
 | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-11 07:59:30 +01:00
										 |  |  |  | Welcome! Our community focuses on helping others and making CoreDNS the best it | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | can be. We gladly accept contributions and encourage you to get involved! | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-03 08:26:51 +01:00
										 |  |  |  | ## Bug reports
 | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 22:51:47 -08:00
										 |  |  |  | First, please [search this repository](https://github.com/coredns/coredns/search?q=&type=Issues&utf8=%E2%9C%93) | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | with a variety of keywords to ensure your bug is not already reported. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 22:51:47 -08:00
										 |  |  |  | If not, [open an issue](https://github.com/coredns/coredns/issues) and answer the | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | questions so we can understand and reproduce the problematic behavior. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-19 07:42:21 +00:00
										 |  |  |  | The burden is on you to convince us that it is actually a bug in CoreDNS. This is | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | easiest to do when you write clear, concise instructions so we can reproduce | 
					
						
							|  |  |  |  | the behavior (even if it seems obvious). The more detailed and specific you are, | 
					
						
							|  |  |  |  | the faster we will be able to help you. Check out | 
					
						
							|  |  |  |  | [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html). | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-19 07:42:21 +00:00
										 |  |  |  | Please be kind. :smile: Remember that CoreDNS comes at no cost to you, and you're | 
					
						
							|  |  |  |  | getting free help. | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-03 08:26:51 +01:00
										 |  |  |  | ## Minor improvements and new tests
 | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 22:51:47 -08:00
										 |  |  |  | Submit [pull requests](https://github.com/coredns/coredns/pulls) at any time. Make | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | sure to write tests to assert your change is working properly and is thoroughly | 
					
						
							|  |  |  |  | covered. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-03 08:26:51 +01:00
										 |  |  |  | ## Proposals, suggestions, ideas, new features
 | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 22:51:47 -08:00
										 |  |  |  | First, please [search](https://github.com/coredns/coredns/search?q=&type=Issues&utf8=%E2%9C%93) | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | with a variety of keywords to ensure your suggestion/proposal is new. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | If so, you may open either an issue or a pull request for discussion and | 
					
						
							|  |  |  |  | feedback. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | The advantage of issues is that you don't have to spend time actually | 
					
						
							|  |  |  |  | implementing your idea, but you should still describe it thoroughly. The | 
					
						
							|  |  |  |  | advantage of a pull request is that we can immediately see the impact the change | 
					
						
							|  |  |  |  | will have on the project, what the code will look like, and how to improve it. | 
					
						
							|  |  |  |  | The disadvantage of pull requests is that they are unlikely to get accepted | 
					
						
							|  |  |  |  | without significant changes, or it may be rejected entirely. Don't worry, that | 
					
						
							|  |  |  |  | won't happen without an open discussion first. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | If you are going to spend significant time implementing code for a pull request, | 
					
						
							|  |  |  |  | best to open an issue first and "claim" it and get feedback before you invest | 
					
						
							|  |  |  |  | a lot of time. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-03 08:26:51 +01:00
										 |  |  |  | ## Vulnerabilities
 | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-07 07:43:38 +00:00
										 |  |  |  | If you've found a vulnerability that is serious, please email me: <miek@miek.nl>. | 
					
						
							| 
									
										
										
										
											2016-03-19 07:42:21 +00:00
										 |  |  |  | If it's not a big deal, a pull request will probably be faster. | 
					
						
							| 
									
										
										
										
											2016-03-18 20:57:35 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-07 07:43:38 +00:00
										 |  |  |  | ## Git Hook
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | We use `golint` and `go vet` as tools to warn use about things (noted golint is obnoxious sometimes, | 
					
						
							|  |  |  |  | but still helpful). Add the following script as a git `post-commit` in `.git/hooks/post-commit` and | 
					
						
							|  |  |  |  | make it executable. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ~~~ sh | 
					
						
							|  |  |  |  | #!/bin/bash
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | # <https://git-scm.com/docs/githooks>:
 | 
					
						
							|  |  |  |  | # The script takes no parameters and its exit status does not affect the commit in any way.  You can
 | 
					
						
							|  |  |  |  | # use git # rev-parse HEAD to get the new commit’s SHA1 hash, or you can use git log -l HEAD to get
 | 
					
						
							|  |  |  |  | # all of its # information.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | for d in *; do | 
					
						
							|  |  |  |  |     if [[ "$d" == "vendor" ]]; then | 
					
						
							|  |  |  |  |         continue | 
					
						
							|  |  |  |  |     fi | 
					
						
							|  |  |  |  |     if [[ "$d" == "logo" ]]; then | 
					
						
							|  |  |  |  |         continue | 
					
						
							|  |  |  |  |     fi | 
					
						
							|  |  |  |  |     if [[ ! -d "$d" ]]; then | 
					
						
							|  |  |  |  |         continue | 
					
						
							|  |  |  |  |     fi | 
					
						
							|  |  |  |  |     golint "$d"/... | 
					
						
							|  |  |  |  | done | 
					
						
							|  |  |  |  | ~~~ | 
					
						
							| 
									
										
										
										
											2017-06-01 11:02:47 -07:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | ## Updating Dependencies
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | We use Golang's [`dep`](https://github.com/golang/dep) as the tool to manage vendor dependencies. | 
					
						
							|  |  |  |  | The tool could be obtained through: | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ```sh | 
					
						
							|  |  |  |  | $ go get -u github.com/golang/dep/cmd/dep | 
					
						
							|  |  |  |  | ``` | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Use the following to update the locked versions of all dependencies | 
					
						
							|  |  |  |  | ```sh | 
					
						
							|  |  |  |  | $ dep ensure -update | 
					
						
							|  |  |  |  | ``` | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | To add a dependency to the project, you might run | 
					
						
							|  |  |  |  | ```sh | 
					
						
							|  |  |  |  | $ dep ensure github.com/pkg/errors | 
					
						
							|  |  |  |  | ``` | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | After the dependencies have been updated or added, you might run the following to | 
					
						
							|  |  |  |  | prune vendored packages: | 
					
						
							|  |  |  |  | ```sh | 
					
						
							|  |  |  |  | $ dep prune | 
					
						
							|  |  |  |  | ``` | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Please refer to Golang's [`dep`](https://github.com/golang/dep) for more details. | 
					
						
							| 
									
										
										
										
											2017-06-03 08:26:51 +01:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | # Thank you
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Thanks for your help! CoreDNS would not be what it is today without your contributions. |