Skip to content

Commit 0e12edf

Browse files
Merge pull request #8 from chenmingyong0423/feature/enhancement
加强
2 parents 2fe68b3 + e0aa1b8 commit 0e12edf

25 files changed

+467
-454
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: 错误报告 | Bug Report
3+
about: 请详细描述您在使用过程中遇到的问题。| Please provide a detailed description of the issue you encountered during use.
4+
title: ""
5+
labels: ["bug"]
6+
assignees: ''
7+
---
8+
9+
在提交之前请先查找 [已有 issues](https://github.com/chenmingyong0423/go-mongox/issues),避免重复上报。| Before submitting, please search for [existing issues](https://github.com/chenmingyong0423/go-mongox/issues) to avoid duplicate reports.
10+
11+
并且确保自己已经 | Also, ensure that you have:
12+
- [ ] 阅读过文档 | Read the documentation
13+
- [ ] 阅读过注释 | Reviewed the comments
14+
- [ ] 阅读过例子 | Looked at the examples
15+
16+
17+
### 您使用的 mongox 版本 | The version of mongox you are using
18+
19+
### 您遇到的问题 | The issue you encountered.
20+
21+
### 复现步骤 | Steps to reproduce
22+
> 请提供简单的复现代码 | Please provide simple code to reproduce the issue.
23+
24+
### 错误日志或者截图 | Error logs or Screenshots
25+
26+
### 你排查的结果,或者你觉得可行的修复方案 | Your Findings or Possible Solutions
27+
> 可选。我们希望你能够尽量先排查问题,帮助我们减轻维护负担。这对于你个人能力提升同样是有帮助的。| Optional. We hope you can try to troubleshoot the issue first, helping us to reduce our maintenance burden. This is also beneficial for your personal skill development
28+
29+
#### 您期望的结果 | Expected Outcome
30+
31+
### 你设置的的 Go 环境 | Your Go Environment Setting
32+
> 上传 `go env` 的结果 | Upload the result of `go env`
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: 功能请求 | Feature Request
3+
about: 请描述您期望的功能 | The features you expect.
4+
title: '[功能请求] | [Feature Request] '
5+
labels: ['enhancement']
6+
assignees: ''
7+
---
8+
9+
### 使用场景 | Use Case Scenario
10+
> 请尽可能详细地描述您希望添加的功能。包括其具体用途和实现的效果。| Please describe the feature you would like to be added in as much detail as possible. Include its specific use case and how it would function.
11+
12+
### 可行方案 | Feasible Solutions
13+
> 如果你知道有框架提供了类似功能,可以在这里描述,并且给出文档或者例子。 | If you are aware of any frameworks that provide similar features, please describe them here and include documentation or examples.
14+
>
15+
> 如果你有设计思路或者解决方案,请在这里提供。你可以提供多个方案,并且给出自己的选择。| If you have any design ideas or proposed solutions, please share them here. You may provide multiple options and explain your preference.
16+
17+
### 其它 | Others
18+
> 任何你觉得有利于解决问题的补充说明 | Any additional information you think may be helpful in solving the problem.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: 问题 | Question
3+
about: 你想问的问题 | The question you want to ask
4+
title: ''
5+
labels: ["question"]
6+
---
7+
8+
在提交之前请先查找 [已有 issues](https://github.com/chenmingyong0423/go-mongox/issues),避免重复上报。| Before submitting, please search for [existing issues](https://github.com/chenmingyong0423/go-mongox/issues) to avoid duplicate reports.
9+
10+
### 您使用的 mongox 版本 | The version of mongox you are using
11+
12+
### 你的问题 | Your question
13+
14+
### 你设置的的 Go 环境 | Your Go Environment Setting
15+
> 上传 `go env` 的结果 | Upload the result of `go env`

.github/ISSUE_TEMPLATE/refactor.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: 重构请求 | Refactor request
3+
about: 重构已有代码 | Refactor existing code
4+
title: ''
5+
labels: [ refactor ]
6+
assignees: ''
7+
---
8+
9+
在提交之前请先查找 [已有 issues](https://github.com/chenmingyong0423/go-mongox/issues),避免重复上报。| Before submitting, please search for [existing issues](https://github.com/chenmingyong0423/go-mongox/issues) to avoid duplicate reports.
10+
11+
### 您使用的 mongox 版本 | The version of mongox you are using
12+
13+
### 当前实现缺陷 | Current Implementation Deficiencies
14+
15+
### 重构方案 | Refactoring Plan
16+
> 描述可以如何重构,以及重构之后带来的效果,如可读性、性能等方面的提升 | Describe how you can refactor, and the benefits it would bring, such as improvements in readability, performance, etc
17+
18+
### 其它 | Others
19+
> 任何你觉得有利于解决问题的补充说明 | Any other information you think would be helpful in addressing the issue
20+
21+
### 你设置的的 Go 环境 | Your Go Environment Setting
22+
> 上传 `go env` 的结果 | Upload the result of `go env`

.github/pre-commit

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2023 chenmingyong0423
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# This script does not handle file names that contain spaces.
16+
17+
# Pre-commit configuration
18+
19+
RESULT=$(make check)
20+
printf "Checking in progress...\n"
21+
22+
if [ -n "$RESULT" ]; then
23+
echo >&2 "[ERROR]: One or more files have changed, please add the changed files to this submission."
24+
exit 1
25+
fi
26+
27+
exit 0

.github/pre-push

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2023 chenmingyong0423
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# This script does not handle file names that contain spaces.
16+
17+
# Pre-push configuration
18+
remote=$1
19+
url=$2
20+
echo >&2 "Try pushing $2 to $1"
21+
22+
TEST="go test ./... -race -cover -failfast"
23+
24+
LINTER="golangci-lint run"
25+
26+
# Run test and return if failed
27+
printf "Running go test..."
28+
$TEST
29+
RESULT=$?
30+
if [ $RESULT -ne 0 ]; then
31+
echo >&2 "$TEST"
32+
echo >&2 "Check code to pass test."
33+
exit 1
34+
fi
35+
36+
# Run linter and return if failed
37+
printf "Running go linter..."
38+
$LINTER
39+
RESULT=$?
40+
if [ $RESULT -ne 0 ]; then
41+
echo >&2 "$LINTER"
42+
echo >&2 "Check code to pass linter."
43+
exit 1
44+
fi
45+
46+
exit 0

.github/workflows/go-fmt.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2023 chenmingyong0423
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Format Go code
16+
17+
on:
18+
push:
19+
branches: [ main, dev]
20+
pull_request:
21+
branches: [ main, dev]
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: ">=1.22.0"
32+
33+
- name: Install goimports
34+
run: go install golang.org/x/tools/cmd/goimports@latest
35+
36+
- name: Check
37+
run: |
38+
make check
39+
if [ -n "$(git status --porcelain)" ]; then
40+
echo >&2 "error: Please execute the command → 'make check' in the local warehouse and submit again."
41+
exit 1
42+
fi

.github/workflows/go.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2023 chenmingyong0423
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This workflow will build a golang project
16+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
17+
18+
name: Go
19+
20+
on:
21+
push:
22+
branches: [ "main", "dev" ]
23+
pull_request:
24+
branches: [ "main", "dev" ]
25+
26+
jobs:
27+
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@v5
35+
with:
36+
go-version: '1.22'
37+
38+
- name: Build
39+
run: go build -v ./...
40+
41+
- name: Test
42+
run: go test -race -coverprofile=cover.out -v ./...
43+
44+
- name: Post Coverage
45+
uses: codecov/codecov-action@v4
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2023 chenmingyong0423
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: golangci-lint
16+
on:
17+
push:
18+
tags:
19+
- v*
20+
branches:
21+
- master
22+
- main
23+
- dev
24+
pull_request:
25+
permissions:
26+
contents: read
27+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
28+
# pull-requests: read
29+
jobs:
30+
golangci:
31+
name: lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/setup-go@v5
35+
with:
36+
go-version: '1.22'
37+
- uses: actions/checkout@v4
38+
- name: golangci-lint
39+
uses: golangci/golangci-lint-action@v6
40+
with:
41+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
42+
version: latest
43+
44+
# Optional: working directory, useful for monorepos
45+
# working-directory: somedir
46+
47+
# Optional: golangci-lint command line arguments.
48+
args: --timeout=10m # --issues-exit-code=0
49+
50+
# Optional: show only new issues if it's a pull request. The default value is `false`.
51+
only-new-issues: true
52+
53+
# Optional: if set to true then the all caching functionality will be complete disabled,
54+
# takes precedence over all other caching options.
55+
# skip-cache: true
56+
57+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
58+
# skip-pkg-cache: true
59+
60+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
61+
# skip-build-cache: true

.github/workflows/stale.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 chenmingyong0423
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Mark stale issues and pull requests
16+
17+
on:
18+
schedule:
19+
- cron: "30 1 * * *"
20+
21+
jobs:
22+
stale:
23+
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/stale@v9
28+
with:
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
stale-issue-message: 'This issue is inactive for a long time.'
31+
stale-pr-message: 'This PR is inactive for a long time'
32+
stale-issue-label: 'inactive-issue'
33+
stale-pr-label: 'inactive-pr'

0 commit comments

Comments
 (0)