English · 中文 · Українська · Česky · Magyar · Español · فارسی · Français · Deutsch · Polski · Indonesian · Suomi · മലയാളം · 日本語 · Nederlands · Italiano · Русский · Português (Brasil) · Esperanto · 한국어 · العربي · Tiếng Việt · Dansk · Ελληνικά · Türkçe
This guide will use openimsdk/open-im-server as an example to explain in detail how to contribute code to the OpenIM project. We adopt a "one issue, one branch" strategy to ensure each issue corresponds to a dedicated branch for effective code change management.
Go to the openimsdk/open-im-server GitHub page, click the "Fork" button in the upper right corner to fork the repository to your GitHub account.
Clone the repository you forked to your local machine:
git clone https://github.com/your-username/open-im-server.git
Add the original repository as a remote upstream to track updates:
git remote add upstream https://github.com/openimsdk/open-im-server.git
Create a new issue in the original repository detailing the problem you encountered or the new feature you wish to add.
Create a new branch off the main branch with a descriptive name and Issue ID, for example:
git checkout -b fix-bug-123
After making changes on your local branch, commit these changes:
git add .
git commit -m "Describe your changes
in detail"
Push your branch back to your GitHub fork:
git push origin fix-bug-123
Go to your fork on GitHub and click the "Pull Request" button. Ensure the PR description is clear and links to the related issue.
If this is your first time submitting a PR, you will need to reply in the comments of the PR:
I have read the CLA Document and I hereby sign the CLA
Please refer to the following documents for detailed information on Go language programming standards:
- Do not use the standard
log
package. - Use the
"github.com/openimsdk/tools/log"
package for logging, which supports multiple log levels:debug
,info
,warn
,error
. - Error logs should only be printed in the function where they are first actively called to prevent log duplication and ensure clear error context.
- Prohibit the use of
panic
: The code should not usepanic
to avoid abrupt termination when encountering unrecoverable errors. - Error Wrapping: Use
"github.com/openimsdk/tools/errs"
to wrap errors, maintaining the integrity of error information and facilitating debugging. - Error Propagation: If a function cannot handle an error itself, it should return the error to the caller, rather than hiding or ignoring it.