Debian Codegraph @

CONTRIBUTING.md

raw
1 # Contributing
2
3 Thanks for your interest in contributing! This document contains `nats-io/nats.go` specific contributing details. If you
4 are a first-time contributor, please refer to the general [NATS Contributor Guide](https://nats.io/contributing/) to get
5 a comprehensive overview of contributing to the NATS project.
6
7 ## Getting started
8
9 There are three general ways you can contribute to this repo:
10
11 - Proposing an enhancement or new feature
12 - Reporting a bug or regression
13 - Contributing changes to the source code
14
15 For the first two, refer to the [GitHub Issues](https://github.com/nats-io/nats.go/issues/new/choose) which guides you
16 through the available options along with the needed information to collect.
17
18 ## Contributing changes
19
20 _Prior to opening a pull request, it is recommended to open an issue first to ensure the maintainers can review intended
21 changes. Exceptions to this rule include fixing non-functional source such as code comments, documentation or other
22 supporting files._
23
24 Proposing source code changes is done through GitHub's standard pull request workflow.
25
26 If your branch is a work-in-progress then please start by creating your pull requests as draft, by clicking the
27 down-arrow next to the `Create pull request` button and instead selecting `Create draft pull request`.
28
29 This will defer the automatic process of requesting a review from the NATS team and significantly reduces noise until
30 you are ready. Once you are happy, you can click the `Ready for review` button.
31
32 ### Guidelines
33
34 A good pull request includes:
35
36 - A high-level description of the changes, including links to any issues that are related by adding comments
37 like `Resolves #NNN` to your description.
38 See [Linking a Pull Request to an Issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
39 for more information.
40 - An up-to-date parent commit. Please make sure you are pulling in the latest `main` branch and rebasing your work on
41 top of it, i.e. `git rebase main`.
42 - Unit tests where appropriate. Bug fixes will benefit from the addition of regression tests. New features will not be
43 accepted without suitable test coverage!
44 - No more commits than necessary. Sometimes having multiple commits is useful for telling a story or isolating changes
45 from one another, but please squash down any unnecessary commits that may just be for clean-up, comments or small
46 changes.
47 - No additional external dependencies that aren't absolutely essential. Please do everything you can to avoid pulling in
48 additional libraries/dependencies into `go.mod` as we will be very critical of these.
49
50 ### Sign-off
51
52 In order to accept a contribution, you will first need to certify that the contribution is your original work and that
53 you license the work to the project under
54 the [Apache-2.0 license](https://github.com/nats-io/nats.go/blob/main/LICENSE).
55
56 This is done by using `Signed-off-by` statements, which should appear in **both** your commit messages and your PR
57 description. Please note that we can only accept sign-offs under a legal name. Nicknames and aliases are not permitted.
58
59 To perform a sign-off with `git`, use `git commit -s` (or `--signoff`).
60
61 ## Get help
62
63 If you have questions about the contribution process, please start
64 a [GitHub discussion](https://github.com/nats-io/nats.go/discussions), join the [NATS Slack](https://slack.nats.io/), or
65 send your question to the [NATS Google Group](https://groups.google.com/forum/#!forum/natsio).
66
67 ## Testing
68
69 The integration tests run against real NATS servers spawned by a tester service. Locally it runs inside the test binary
70 (`github.com/synadia-io/orbit.go/ntf`), so no docker is needed; CI uses the
71 [synadia/ntf-server](https://hub.docker.com/r/synadia/ntf-server) docker image instead. See [TESTING.md](TESTING.md) for
72 the full workflow; the short version:
73
74 ```shell
75 make test # full race-enabled suite, no docker
76 make test T=TestName PKG=./test/... # iterate on a single test
77 ```
78
79 Nothing to install or start.
80
81 You should use `go_test.mod` to manage your testing dependencies. Please use the following command to update your
82 dependencies and avoid changing the main `go.mod` in a PR:
83
84 ```shell
85 go mod tidy -modfile=go_test.mod
86 ```