github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/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  See [Step by Step Contribute Example](step_by_step_contribute.md) for a more detailed example.
     8  
     9  ## Getting started
    10  
    11  - Fork the repository on GitHub.
    12  - Read the README.md for build instructions.
    13  - Play with the project, submit bugs, submit patches!
    14  
    15  ## Building DM
    16  
    17  Developing DM requires:
    18  
    19  * [Go 1.16+](http://golang.org/doc/code.html)
    20  * An internet connection to download the dependencies
    21  
    22  Simply run `make` to build the program.
    23  
    24  ```sh
    25  make
    26  ```
    27  
    28  ### Running tests
    29  
    30  This project contains unit tests and integration tests with coverage collection.
    31  See [tests/README.md](./tests/README.md) for how to execute and add tests.
    32  
    33  ### Updating generated code
    34  
    35  DM contains some proto files. To modify them,
    36  you also need to install:
    37  
    38  * [protoc 3.6+](https://github.com/protocolbuffers/protobuf/releases)
    39  * [protoc-gen-gogofaster 1.2+](https://github.com/gogo/protobuf#more-speed-and-more-generated-code)
    40  
    41  Run `make generate_proto` to regenerate go code files.
    42  
    43  ### Updating dependencies
    44  
    45  DM uses [Go 1.11 module](https://github.com/golang/go/wiki/Modules) to manage dependencies.
    46  To add or update a dependency: use the `go mod edit` command to change the dependency.
    47  
    48  ## Contribution flow
    49  
    50  This is a rough outline of what a contributor's workflow looks like:
    51  
    52  - Create a topic branch from where you want to base your work. This is usually `master`.
    53  - Make commits of logical units and add test case if the change fixes a bug or adds new functionality.
    54  - Run tests and make sure all the tests are passed.
    55  - Make sure your commit messages are in the proper format (see below).
    56  - Push your changes to a topic branch in your fork of the repository.
    57  - Submit a pull request.
    58  - Your PR must receive LGTMs from two maintainers.
    59  
    60  Thanks for your contributions!
    61  
    62  ### Code style
    63  
    64  The coding style suggested by the Golang community is used in DM.
    65  See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details.
    66  
    67  Please follow this style to make DM easy to review, maintain and develop.
    68  
    69  ### Format of the Commit Message
    70  
    71  We follow a rough convention for commit messages that is designed to answer two
    72  questions: what changed and why. The subject line should feature the what and
    73  the body of the commit should describe the why.
    74  
    75  ```
    76  worker(dm): add comment for variable declaration
    77  
    78  Improve documentation.
    79  ```
    80  
    81  The format can be described more formally as follows:
    82  
    83  ```
    84  <subsystem>(ticdc|dm|both): <what changed>
    85  <BLANK LINE>
    86  <why this change was made>
    87  <BLANK LINE>
    88  <footer>(optional)
    89  ```
    90  
    91  The first line is the subject and should be no longer than 70 characters, the second line is always blank, and other
    92  lines should be wrapped at 80 characters. This allows the message to be easier to read on GitHub as well as in various
    93  git tools.
    94  
    95  If the change affects more than one subsystem, you can use comma to separate them like ```worker,syncer:```. If the
    96  change affects many subsystems, you can use ```*``` instead, like ```*:```.
    97  
    98  If this change affects ticdc, fill in ```<subsystem>(ticdc)```, if it affects dm, fill in ```<subsystem>(dm)```. If it
    99  involves a code that is used by both products, fill in ```<subsystem>(both)```.
   100  
   101  For the why part, if no specific reason for the change, you can use one of some generic reasons like "Improve
   102  documentation.",
   103  "Improve performance.", "Improve robustness.", "Improve test coverage."