|
1 | 1 | # Contributing to Go-Spring |
2 | 2 |
|
3 | | -First of all, thank you for your interest in and support of the Go-Spring project! |
| 3 | +First of all, thank you for your interest in and support of the Go-Spring project! |
| 4 | +Before contributing, please read our [Contributor Code of Conduct](CODE_OF_CONDUCT.md). |
4 | 5 |
|
5 | 6 | We welcome all kinds of contributions, including reporting issues, improving documentation, fixing bugs, and developing |
6 | | -new features. Please follow the guidelines below to contribute: |
| 7 | +new features. Please follow the guidelines below to contribute. |
| 8 | + |
| 9 | +## Table of Contents |
| 10 | + |
| 11 | +- [Submitting Issues](#submitting-issues) |
| 12 | +- [Submitting Pull Requests](#submitting-pull-requests) |
| 13 | +- [Branch Naming Guidelines](#branch-naming-guidelines) |
| 14 | +- [Local Development Environment](#local-development-environment) |
| 15 | +- [Testing](#testing) |
| 16 | +- [Contact Us](#contact-us) |
7 | 17 |
|
8 | 18 | ## Submitting Issues |
9 | 19 |
|
10 | | -- Before submitting, please search existing issues to avoid duplicates. |
| 20 | +- Search existing issues before submitting to avoid duplicates. |
11 | 21 | - Provide clear reproduction steps, expected behavior, and actual results. |
12 | | -- If available, include error logs and relevant environment information. |
| 22 | +- Include error logs and environment information if applicable. |
13 | 23 |
|
14 | 24 | ## Submitting Pull Requests |
15 | 25 |
|
16 | 26 | 1. **Fork the repository and create a new branch** |
| 27 | + |
17 | 28 | ```bash |
18 | 29 | git checkout -b feature/your-feature-name |
19 | | - ``` |
| 30 | + ```` |
20 | 31 |
|
21 | 32 | 2. **Maintain consistent coding style** |
22 | | - - Follow Go’s official style guidelines (use `gofmt`, `golint`, `go vet`) |
23 | | - - It’s recommended to use [`golangci-lint`](https://github.com/golangci/golangci-lint) for local linting |
| 33 | + |
| 34 | + * Follow Go’s official style guidelines (`gofmt`, `golint`, `go vet`). |
| 35 | + * Recommended: [`golangci-lint`](https://github.com/golangci/golangci-lint) for local linting. |
24 | 36 |
|
25 | 37 | 3. **Write tests** |
26 | | - - All new features must include unit tests |
27 | | - - Use Go’s built-in `testing` package, and name test files as `xxx_test.go` |
28 | 38 |
|
29 | | -4. **Update documentation (if applicable)** |
| 39 | + * All new features or bug fixes must include unit tests. |
| 40 | + * Use Go’s `testing` package; test files should be named `xxx_test.go`. |
| 41 | + * Example: |
| 42 | + |
| 43 | + ```go |
| 44 | + func TestAdd(t *testing.T) { |
| 45 | + result := Add(1, 2) |
| 46 | + if result != 3 { |
| 47 | + t.Errorf("expected 3, got %d", result) |
| 48 | + } |
| 49 | + } |
| 50 | + ``` |
| 51 | +
|
| 52 | +4. **Update documentation** |
| 53 | +
|
| 54 | + * If your changes affect usage or APIs, update README or code comments. |
30 | 55 |
|
31 | 56 | 5. **Submit and create a Pull Request** |
32 | | - - Clearly describe the purpose, changes made, and testing results |
33 | | - - Link relevant issues (if any) |
| 57 | +
|
| 58 | + * Clearly describe: |
| 59 | +
|
| 60 | + * **What**: What changes are made |
| 61 | + * **Why**: Why the changes are needed |
| 62 | + * **How**: How it was implemented |
| 63 | + * **Testing**: How it was tested |
| 64 | + * Link related issues if applicable. |
| 65 | +
|
| 66 | +## Branch Naming Guidelines |
| 67 | +
|
| 68 | +* `feature/xxx` – New feature |
| 69 | +* `fix/xxx` – Bug fix |
| 70 | +* `doc/xxx` – Documentation updates |
| 71 | +* `refactor/xxx` – Code refactoring |
34 | 72 |
|
35 | 73 | ## Local Development Environment |
36 | 74 |
|
37 | | -- Go version: Latest stable release is recommended (e.g., `go1.21+`) |
38 | | -- Use Go Modules for dependency management |
39 | | -- Make sure all tests pass: |
| 75 | +* Recommended Go version: latest stable release (e.g., `go1.21+`) |
| 76 | +* Use Go Modules for dependency management. |
| 77 | +* Make sure all tests pass before submitting: |
| 78 | +
|
40 | 79 | ```bash |
41 | 80 | go test ./... |
42 | 81 | ``` |
43 | 82 |
|
| 83 | +## Testing |
| 84 | +
|
| 85 | +* Run `go test ./...` to ensure all tests pass. |
| 86 | +* For examples or integration tests, provide instructions if needed. |
| 87 | +
|
44 | 88 | ## Contact Us |
45 | 89 |
|
46 | | -If you have any questions, feel free to open an issue or join the discussion forum. |
| 90 | +* Open an issue on GitHub for questions or feedback. |
| 91 | +* Join project discussions via the community forum or chat. |
47 | 92 |
|
48 | | -Thank you for contributing! |
| 93 | +Thank you for contributing to Go-Spring! |
49 | 94 |
|
50 | | ---- |
| 95 | +--- |
51 | 96 |
|
52 | | -# Contributing to Go-Spring |
| 97 | +# 贡献 Go-Spring 的指南 |
53 | 98 |
|
54 | 99 | 首先,感谢你关注并支持 Go-Spring 项目! |
| 100 | +在贡献之前,请先阅读我们的 [贡献者行为准则](CODE_OF_CONDUCT.md)。 |
| 101 | +
|
| 102 | +我们欢迎各种形式的贡献,包括提交 Issue、完善文档、修复 Bug、开发新功能等。请按照以下指引参与贡献。 |
55 | 103 |
|
56 | | -我们欢迎各种形式的贡献,包括但不限于 Issue 提交、文档完善、Bug 修复、功能开发等。请按照以下指引参与贡献: |
| 104 | +## 目录 |
| 105 | +
|
| 106 | +* [提交 Issue](#提交-issue) |
| 107 | +* [提交 Pull Request](#提交-pull-request) |
| 108 | +* [分支命名规范](#分支命名规范) |
| 109 | +* [本地开发环境要求](#本地开发环境要求) |
| 110 | +* [测试](#测试) |
| 111 | +* [联系我们](#联系我们) |
57 | 112 |
|
58 | 113 | ## 提交 Issue |
59 | 114 |
|
60 | | -- 在提交前,请先搜索现有的 Issue,避免重复提交。 |
61 | | -- 请提供清晰的复现步骤、预期行为以及实际结果。 |
62 | | -- 如有错误日志或运行环境信息,请一并附上。 |
| 115 | +* 在提交前,请先搜索现有 Issue,避免重复。 |
| 116 | +* 提供清晰的复现步骤、预期行为以及实际结果。 |
| 117 | +* 如有错误日志或运行环境信息,请一并附上。 |
63 | 118 |
|
64 | 119 | ## 提交 Pull Request |
65 | 120 |
|
66 | 121 | 1. **Fork 仓库并创建新分支** |
| 122 | +
|
67 | 123 | ```bash |
68 | 124 | git checkout -b feature/your-feature-name |
69 | 125 | ``` |
70 | 126 |
|
71 | 127 | 2. **保持一致的代码风格** |
72 | | - - 遵循 Go 官方代码规范(使用 `gofmt`、`golint`、`go vet`) |
73 | | - - 推荐使用 [`golangci-lint`](https://github.com/golangci/golangci-lint) 进行本地代码检查 |
| 128 | +
|
| 129 | + * 遵循 Go 官方代码规范(使用 `gofmt`、`golint`、`go vet`)。 |
| 130 | + * 推荐使用 [`golangci-lint`](https://github.com/golangci/golangci-lint) 进行本地检查。 |
74 | 131 |
|
75 | 132 | 3. **编写测试用例** |
76 | | - - 所有新功能必须配备单元测试 |
77 | | - - 使用 Go 内置的 `testing` 包,测试文件应命名为 `xxx_test.go` |
78 | 133 |
|
79 | | -4. **更新相关文档(如有变更)** |
| 134 | + * 所有新功能或 Bug 修复必须配备单元测试。 |
| 135 | + * 使用 Go 内置 `testing` 包,测试文件命名为 `xxx_test.go`。 |
| 136 | + * 示例: |
| 137 | +
|
| 138 | + ```go |
| 139 | + func TestAdd(t *testing.T) { |
| 140 | + result := Add(1, 2) |
| 141 | + if result != 3 { |
| 142 | + t.Errorf("expected 3, got %d", result) |
| 143 | + } |
| 144 | + } |
| 145 | + ``` |
| 146 | +
|
| 147 | +4. **更新文档** |
| 148 | +
|
| 149 | + * 如果变更影响使用或接口,请同步更新 README 或代码注释。 |
80 | 150 |
|
81 | 151 | 5. **提交并创建 Pull Request** |
82 | | - - 说明 PR 的目的、变更内容、测试情况等 |
83 | | - - 关联相关 Issue(如有) |
| 152 | +
|
| 153 | + * 清晰说明: |
| 154 | +
|
| 155 | + * **What**:本次修改的内容 |
| 156 | + * **Why**:修改原因 |
| 157 | + * **How**:实现方式 |
| 158 | + * **Testing**:测试情况 |
| 159 | + * 关联相关 Issue(如有)。 |
| 160 | +
|
| 161 | +## 分支命名规范 |
| 162 | +
|
| 163 | +* `feature/xxx` – 新功能 |
| 164 | +* `fix/xxx` – Bug 修复 |
| 165 | +* `doc/xxx` – 文档更新 |
| 166 | +* `refactor/xxx` – 代码重构 |
84 | 167 |
|
85 | 168 | ## 本地开发环境要求 |
86 | 169 |
|
87 | | -- Go 版本:推荐使用最新版稳定版(如 `go1.21+`) |
88 | | -- 使用 Go Modules 进行依赖管理 |
89 | | -- 确保测试全部通过: |
| 170 | +* Go 版本:推荐使用最新版稳定版(如 `go1.21+`) |
| 171 | +* 使用 Go Modules 管理依赖 |
| 172 | +* 提交前确保所有测试通过: |
| 173 | +
|
90 | 174 | ```bash |
91 | 175 | go test ./... |
92 | 176 | ``` |
93 | 177 |
|
| 178 | +## 测试 |
| 179 | +
|
| 180 | +* 运行 `go test ./...` 确保所有测试通过 |
| 181 | +* 对于示例或集成测试,请提供使用说明(如适用) |
| 182 | +
|
94 | 183 | ## 联系我们 |
95 | 184 |
|
96 | | -如有疑问,欢迎通过 Issue 与我们联系,或参与项目的讨论区。 |
| 185 | +* 可通过 GitHub Issue 提问或反馈 |
| 186 | +* 参与项目讨论区交流 |
97 | 187 |
|
98 | | -感谢你的贡献! |
| 188 | +感谢你为 Go-Spring 做出的贡献! |
0 commit comments