Skip to content

Commit 9f1e779

Browse files
authored
Merge pull request #36 from lvan100/main
optimize error handling
2 parents 6d3e531 + 95fc40f commit 9f1e779

File tree

147 files changed

+3633
-6328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+3633
-6328
lines changed

CODE_OF_CONDUCT.md

Lines changed: 105 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
Thank you for your interest in and support of the Go-Spring project!
44

55
To cultivate an open, respectful, inclusive, and professional community, we ask that all participants follow this Code
6-
of Conduct in every interaction—whether reporting issues, submitting code, engaging in discussions, or contributing in
7-
any other way.
6+
of Conduct in every interaction—whether reporting issues, submitting code, engaging in discussions, or participating in
7+
any official project activity.
8+
9+
## Scope
10+
11+
This Code of Conduct applies to all interactions related to the Go-Spring project, including but not limited to:
12+
13+
* Issues and pull requests on the repository
14+
* Discussions in forums, chat channels, or mailing lists
15+
* Contributions to documentation, wiki, or website
16+
* Participation in online or offline project events
817

918
## Our Commitment
1019

@@ -13,30 +22,58 @@ experience level. We value and support diversity and inclusivity within our comm
1322

1423
## Encouraged Behavior
1524

16-
- Communicate with respect and courtesy.
17-
- Welcome and consider constructive feedback.
18-
- Appreciate diverse perspectives and technical choices.
19-
- Demonstrate patience and empathy in collaborations.
20-
- Contribute positively to a welcoming and supportive environment.
25+
* Communicate with respect and courtesy
26+
* Welcome and consider constructive feedback
27+
* Appreciate diverse perspectives and technical choices
28+
* Demonstrate patience and empathy in collaborations
29+
* Contribute positively to a welcoming and supportive environment
30+
31+
**Examples of encouraged behavior:**
32+
33+
* Providing constructive code reviews
34+
* Welcoming newcomers with guidance
35+
* Sharing knowledge in a respectful manner
2136

2237
## Unacceptable Behavior
2338

24-
- Use of discriminatory, abusive, or offensive language or conduct.
25-
- Harassment, threats, or personal attacks.
26-
- Sharing explicit content or inappropriate links.
27-
- Deliberate disruption of constructive efforts.
28-
- Impersonation or violation of personal privacy.
39+
* Use of discriminatory, abusive, or offensive language or conduct
40+
* Harassment, threats, or personal attacks
41+
* Sharing explicit content or inappropriate links
42+
* Deliberate disruption of constructive efforts
43+
* Impersonation or violation of personal privacy
44+
45+
**Examples of unacceptable behavior:**
46+
47+
* Using slurs or offensive language
48+
* Harassing contributors for opinions or technical choices
49+
* Posting inappropriate content or links
2950

30-
## Enforcement
51+
## Reporting Violations
52+
53+
If you witness or experience a violation of this Code of Conduct, please report it to the project maintainers via email
54+
or by submitting an anonymous issue.
55+
56+
When reporting a violation, please provide:
57+
58+
* Description of the incident
59+
* Links to relevant content or screenshots
60+
* Names of involved participants (if known)
61+
62+
Maintainers will respond within 48 hours and handle all reports confidentially.
63+
64+
## Enforcement and Consequences
3165

3266
Project maintainers are responsible for upholding this Code of Conduct. They have the authority to remove, edit, or
3367
reject comments, commits, code, wiki edits, issues, or other contributions that violate these guidelines, and to take
3468
further action as necessary.
3569

36-
## Reporting Violations
70+
Possible consequences for violations include:
3771

38-
If you witness or experience a violation of this Code of Conduct, please contact the maintainers via email or submit an
39-
anonymous issue. All reports will be handled with discretion and taken seriously.
72+
* Removal of contributions or comments
73+
* Temporary or permanent suspension of project access
74+
* Reporting to relevant platform authorities
75+
76+
Appeals can be submitted via email to the maintainers.
4077

4178
---
4279

@@ -46,30 +83,67 @@ anonymous issue. All reports will be handled with discretion and taken seriously
4683

4784
为营造一个开放、友善、包容和专业的社区氛围,我们制定了本行为准则。无论你是报告问题、提交代码、参与讨论,还是以其他形式参与项目,都请遵循以下准则。
4885

86+
## 适用范围
87+
88+
本行为准则适用于与 Go-Spring 项目相关的所有活动,包括但不限于:
89+
90+
* 仓库中的 Issue 和 Pull Request
91+
* 论坛、聊天群或邮件列表中的讨论
92+
* 文档、Wiki 或网站的贡献
93+
* 线上或线下的官方项目活动
94+
4995
## 我们的承诺
5096

51-
我们承诺为每一位参与者提供一个免受骚扰、歧视和攻击性行为干扰的环境。我们欢迎来自不同背景、经验和身份的贡献者,共同建设一个多元、包容的社区。
97+
我们承诺为每一位参与者提供一个免受骚扰干扰的环境,无论年龄、背景、身份或经验水平。我们欢迎来自不同背景的贡献者,共同建设一个多元、包容的社区。
5298

5399
## 倡导的行为
54100

55-
- 保持尊重、礼貌的沟通方式;
56-
- 乐于接受建设性的意见与反馈;
57-
- 尊重不同的观点与技术选择;
58-
- 在协作中体现耐心与包容;
59-
- 积极参与,共建积极向上的社区氛围。
101+
* 保持尊重、礼貌的沟通方式
102+
* 乐于接受建设性的意见与反馈
103+
* 尊重不同的观点与技术选择
104+
* 在协作中体现耐心与包容
105+
* 积极参与,共建积极向上的社区氛围
106+
107+
**正面行为示例:**
108+
109+
* 提供建设性的代码审查
110+
* 欢迎新人并提供指导
111+
* 尊重他人分享知识
60112

61113
## 不被接受的行为
62114

63-
- 使用歧视性、侮辱性或攻击性的言语与行为;
64-
- 进行人身攻击、骚扰或威胁;
65-
- 发布淫秽内容或不当链接;
66-
- 蓄意干扰他人正常贡献;
67-
- 冒充他人或侵犯他人隐私。
115+
* 使用歧视性、侮辱性或攻击性的言语与行为
116+
* 人身攻击、骚扰或威胁他人
117+
* 发布淫秽内容或不当链接
118+
* 蓄意干扰他人正常贡献
119+
* 冒充他人或侵犯他人隐私
120+
121+
**违规行为示例:**
122+
123+
* 使用侮辱性词语或攻击性语言
124+
* 因观点或技术选择骚扰贡献者
125+
* 发布不当内容或链接
126+
127+
## 举报违规行为
128+
129+
若你遇到或目击违反本行为准则的情况,请通过电子邮件联系项目维护者,或通过 Issue 匿名举报。
130+
131+
提交举报时,请尽量提供以下信息:
132+
133+
* 事件描述
134+
* 相关内容链接或截图
135+
* 相关人员姓名(如已知)
136+
137+
维护者将在 48 小时内回复,并确保信息保密。
138+
139+
## 执行与后果
68140

69-
## 执行与维护
141+
项目维护者有权也有责任删除、修改或拒绝任何违反行为准则的评论、提交、代码、Wiki 编辑、Issue 或其他形式的贡献内容,并在必要时采取进一步措施。
70142

71-
项目维护者有权也有责任删除、修改或拒绝任何违反行为准则的评论、提交、代码、Wiki 编辑、Issue 或其他形式的贡献内容,必要时可采取进一步措施。
143+
违规可能导致的后果包括:
72144

73-
## 如何报告问题
145+
* 删除贡献内容或评论
146+
* 暂停或永久禁用项目访问权限
147+
* 向相关平台报告
74148

75-
若你遇到违反行为准则的情况,请通过电子邮件联系项目维护者,或通过 Issue 匿名举报。我们承诺认真对待每一份举报,并确保信息保密
149+
如对处理结果有异议,可通过电子邮件向维护者提交申诉

CONTRIBUTING.md

Lines changed: 125 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,188 @@
11
# Contributing to Go-Spring
22

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).
45

56
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)
717

818
## Submitting Issues
919

10-
- Before submitting, please search existing issues to avoid duplicates.
20+
- Search existing issues before submitting to avoid duplicates.
1121
- 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.
1323

1424
## Submitting Pull Requests
1525

1626
1. **Fork the repository and create a new branch**
27+
1728
```bash
1829
git checkout -b feature/your-feature-name
19-
```
30+
````
2031

2132
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.
2436

2537
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`
2838

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.
3055
3156
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
3472
3573
## Local Development Environment
3674
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+
4079
```bash
4180
go test ./...
4281
```
4382
83+
## Testing
84+
85+
* Run `go test ./...` to ensure all tests pass.
86+
* For examples or integration tests, provide instructions if needed.
87+
4488
## Contact Us
4589
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.
4792
48-
Thank you for contributing!
93+
Thank you for contributing to Go-Spring!
4994
50-
---
95+
---
5196
52-
# Contributing to Go-Spring
97+
# 贡献 Go-Spring 的指南
5398
5499
首先,感谢你关注并支持 Go-Spring 项目!
100+
在贡献之前,请先阅读我们的 [贡献者行为准则](CODE_OF_CONDUCT.md)。
101+
102+
我们欢迎各种形式的贡献,包括提交 Issue、完善文档、修复 Bug、开发新功能等。请按照以下指引参与贡献。
55103
56-
我们欢迎各种形式的贡献,包括但不限于 Issue 提交、文档完善、Bug 修复、功能开发等。请按照以下指引参与贡献:
104+
## 目录
105+
106+
* [提交 Issue](#提交-issue)
107+
* [提交 Pull Request](#提交-pull-request)
108+
* [分支命名规范](#分支命名规范)
109+
* [本地开发环境要求](#本地开发环境要求)
110+
* [测试](#测试)
111+
* [联系我们](#联系我们)
57112
58113
## 提交 Issue
59114
60-
- 在提交前,请先搜索现有的 Issue,避免重复提交
61-
- 请提供清晰的复现步骤、预期行为以及实际结果。
62-
- 如有错误日志或运行环境信息,请一并附上。
115+
* 在提交前,请先搜索现有 Issue,避免重复
116+
* 提供清晰的复现步骤、预期行为以及实际结果。
117+
* 如有错误日志或运行环境信息,请一并附上。
63118
64119
## 提交 Pull Request
65120
66121
1. **Fork 仓库并创建新分支**
122+
67123
```bash
68124
git checkout -b feature/your-feature-name
69125
```
70126
71127
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) 进行本地检查。
74131
75132
3. **编写测试用例**
76-
- 所有新功能必须配备单元测试
77-
- 使用 Go 内置的 `testing` 包,测试文件应命名为 `xxx_test.go`
78133
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 或代码注释。
80150
81151
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` – 代码重构
84167
85168
## 本地开发环境要求
86169
87-
- Go 版本:推荐使用最新版稳定版(如 `go1.21+`
88-
- 使用 Go Modules 进行依赖管理
89-
- 确保测试全部通过:
170+
* Go 版本:推荐使用最新版稳定版(如 `go1.21+`
171+
* 使用 Go Modules 管理依赖
172+
* 提交前确保所有测试通过:
173+
90174
```bash
91175
go test ./...
92176
```
93177
178+
## 测试
179+
180+
* 运行 `go test ./...` 确保所有测试通过
181+
* 对于示例或集成测试,请提供使用说明(如适用)
182+
94183
## 联系我们
95184
96-
如有疑问,欢迎通过 Issue 与我们联系,或参与项目的讨论区。
185+
* 可通过 GitHub Issue 提问或反馈
186+
* 参与项目讨论区交流
97187
98-
感谢你的贡献
188+
感谢你为 Go-Spring 做出的贡献

0 commit comments

Comments
 (0)