github.com/pingcap/failpoint@v0.0.0-20240412033321-fd0796e60f86/CONTRIBUTING.md (about) 1 # How to contribute 2 3 This document outlines some of the conventions on development workflow, commit 4 message formatting, contact points and other resources to make it easier to get 5 your contribution accepted. 6 7 ## Getting started 8 9 - Fork the repository on GitHub. 10 - Read the README.md for build instructions. 11 - Play with the project, submit bugs, submit patches! 12 13 ## Building Failpoint 14 15 Developing Failpoint requires: 16 17 * [Go 1.13](http://golang.org/doc/code.html) 18 * An internet connection to download the dependencies 19 20 Simply run `make` to build the program. 21 22 ```sh 23 make 24 ``` 25 26 ### Running tests 27 28 This project contains unit tests and integration tests with coverage collection. 29 See [tests/README.md](./tests/README.md) for how to execute and add tests. 30 31 ### Updating dependencies 32 33 Failpoint manages dependencies using [Go module](https://github.com/golang/go/wiki/Modules). 34 To add or update a dependency, either 35 36 * Use the `go mod edit` command to change the dependency, or 37 * Edit `go.mod` and then run `make update` to update the checksum. 38 39 ## Contribution flow 40 41 This is a rough outline of what a contributor's workflow looks like: 42 43 - Create a topic branch from where you want to base your work. This is usually `master`. 44 - Make commits of logical units and add test case if the change fixes a bug or adds new functionality. 45 - Run tests and make sure all the tests are passed. 46 - Make sure your commit messages are in the proper format (see below). 47 - Push your changes to a topic branch in your fork of the repository. 48 - Submit a pull request. 49 - Your PR must receive LGTMs from two maintainers. 50 51 Thanks for your contributions! 52 53 ### Code style 54 55 The coding style suggested by the Golang community is used in `failpoint`. 56 See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details. 57 58 Please follow this style to makeg `failpoint` easy to review, maintain and develop. 59 60 ### Format of the Commit Message 61 62 We follow a rough convention for commit messages that is designed to answer two 63 questions: what changed and why. The subject line should feature the what and 64 the body of the commit should describe the why. 65 66 ``` 67 restore: add comment for variable declaration 68 69 Improve documentation. 70 ``` 71 72 The format can be described more formally as follows: 73 74 ``` 75 <subsystem>: <what changed> 76 <BLANK LINE> 77 <why this change was made> 78 <BLANK LINE> 79 <footer>(optional) 80 ``` 81 82 The first line is the subject and should be no longer than 70 characters, the 83 second line is always blank, and other lines should be wrapped at 80 characters. 84 This allows the message to be easier to read on GitHub as well as in various 85 git tools. 86 87 If the change affects more than one subsystem, you can use comma to separate them like `code,examples:`. 88 89 If the change affects many subsystems, you can use ```*``` instead, like ```*:```. 90 91 For the why part, if no specific reason for the change, 92 you can use one of some generic reasons like "Improve documentation.", 93 "Improve performance.", "Improve robustness.", "Improve test coverage." 94