-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from chenmingyong0423/feature/enhancement
加强
- Loading branch information
Showing
25 changed files
with
467 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: 错误报告 | Bug Report | ||
about: 请详细描述您在使用过程中遇到的问题。| Please provide a detailed description of the issue you encountered during use. | ||
title: "" | ||
labels: ["bug"] | ||
assignees: '' | ||
--- | ||
|
||
在提交之前请先查找 [已有 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. | ||
|
||
并且确保自己已经 | Also, ensure that you have: | ||
- [ ] 阅读过文档 | Read the documentation | ||
- [ ] 阅读过注释 | Reviewed the comments | ||
- [ ] 阅读过例子 | Looked at the examples | ||
|
||
|
||
### 您使用的 mongox 版本 | The version of mongox you are using | ||
|
||
### 您遇到的问题 | The issue you encountered. | ||
|
||
### 复现步骤 | Steps to reproduce | ||
> 请提供简单的复现代码 | Please provide simple code to reproduce the issue. | ||
### 错误日志或者截图 | Error logs or Screenshots | ||
|
||
### 你排查的结果,或者你觉得可行的修复方案 | Your Findings or Possible Solutions | ||
> 可选。我们希望你能够尽量先排查问题,帮助我们减轻维护负担。这对于你个人能力提升同样是有帮助的。| 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 | ||
#### 您期望的结果 | Expected Outcome | ||
|
||
### 你设置的的 Go 环境 | Your Go Environment Setting | ||
> 上传 `go env` 的结果 | Upload the result of `go env` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
name: 功能请求 | Feature Request | ||
about: 请描述您期望的功能 | The features you expect. | ||
title: '[功能请求] | [Feature Request] ' | ||
labels: ['enhancement'] | ||
assignees: '' | ||
--- | ||
|
||
### 使用场景 | Use Case Scenario | ||
> 请尽可能详细地描述您希望添加的功能。包括其具体用途和实现的效果。| 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. | ||
### 可行方案 | Feasible Solutions | ||
> 如果你知道有框架提供了类似功能,可以在这里描述,并且给出文档或者例子。 | If you are aware of any frameworks that provide similar features, please describe them here and include documentation or examples. | ||
> | ||
> 如果你有设计思路或者解决方案,请在这里提供。你可以提供多个方案,并且给出自己的选择。| If you have any design ideas or proposed solutions, please share them here. You may provide multiple options and explain your preference. | ||
### 其它 | Others | ||
> 任何你觉得有利于解决问题的补充说明 | Any additional information you think may be helpful in solving the problem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: 问题 | Question | ||
about: 你想问的问题 | The question you want to ask | ||
title: '' | ||
labels: ["question"] | ||
--- | ||
|
||
在提交之前请先查找 [已有 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. | ||
|
||
### 您使用的 mongox 版本 | The version of mongox you are using | ||
|
||
### 你的问题 | Your question | ||
|
||
### 你设置的的 Go 环境 | Your Go Environment Setting | ||
> 上传 `go env` 的结果 | Upload the result of `go env` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: 重构请求 | Refactor request | ||
about: 重构已有代码 | Refactor existing code | ||
title: '' | ||
labels: [ refactor ] | ||
assignees: '' | ||
--- | ||
|
||
在提交之前请先查找 [已有 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. | ||
|
||
### 您使用的 mongox 版本 | The version of mongox you are using | ||
|
||
### 当前实现缺陷 | Current Implementation Deficiencies | ||
|
||
### 重构方案 | Refactoring Plan | ||
> 描述可以如何重构,以及重构之后带来的效果,如可读性、性能等方面的提升 | Describe how you can refactor, and the benefits it would bring, such as improvements in readability, performance, etc | ||
### 其它 | Others | ||
> 任何你觉得有利于解决问题的补充说明 | Any other information you think would be helpful in addressing the issue | ||
### 你设置的的 Go 环境 | Your Go Environment Setting | ||
> 上传 `go env` 的结果 | Upload the result of `go env` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 chenmingyong0423 | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# This script does not handle file names that contain spaces. | ||
|
||
# Pre-commit configuration | ||
|
||
RESULT=$(make check) | ||
printf "Checking in progress...\n" | ||
|
||
if [ -n "$RESULT" ]; then | ||
echo >&2 "[ERROR]: One or more files have changed, please add the changed files to this submission." | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2023 chenmingyong0423 | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# This script does not handle file names that contain spaces. | ||
|
||
# Pre-push configuration | ||
remote=$1 | ||
url=$2 | ||
echo >&2 "Try pushing $2 to $1" | ||
|
||
TEST="go test ./... -race -cover -failfast" | ||
|
||
LINTER="golangci-lint run" | ||
|
||
# Run test and return if failed | ||
printf "Running go test..." | ||
$TEST | ||
RESULT=$? | ||
if [ $RESULT -ne 0 ]; then | ||
echo >&2 "$TEST" | ||
echo >&2 "Check code to pass test." | ||
exit 1 | ||
fi | ||
|
||
# Run linter and return if failed | ||
printf "Running go linter..." | ||
$LINTER | ||
RESULT=$? | ||
if [ $RESULT -ne 0 ]; then | ||
echo >&2 "$LINTER" | ||
echo >&2 "Check code to pass linter." | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2023 chenmingyong0423 | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Format Go code | ||
|
||
on: | ||
push: | ||
branches: [ main, dev] | ||
pull_request: | ||
branches: [ main, dev] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ">=1.22.0" | ||
|
||
- name: Install goimports | ||
run: go install golang.org/x/tools/cmd/goimports@latest | ||
|
||
- name: Check | ||
run: | | ||
make check | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo >&2 "error: Please execute the command → 'make check' in the local warehouse and submit again." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright 2023 chenmingyong0423 | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "main", "dev" ] | ||
pull_request: | ||
branches: [ "main", "dev" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: go test -race -coverprofile=cover.out -v ./... | ||
|
||
- name: Post Coverage | ||
uses: codecov/codecov-action@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2023 chenmingyong0423 | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: golangci-lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- master | ||
- main | ||
- dev | ||
pull_request: | ||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
- uses: actions/checkout@v4 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: latest | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
args: --timeout=10m # --issues-exit-code=0 | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
only-new-issues: true | ||
|
||
# Optional: if set to true then the all caching functionality will be complete disabled, | ||
# takes precedence over all other caching options. | ||
# skip-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/go/pkg. | ||
# skip-pkg-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | ||
# skip-build-cache: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2023 chenmingyong0423 | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Mark stale issues and pull requests | ||
|
||
on: | ||
schedule: | ||
- cron: "30 1 * * *" | ||
|
||
jobs: | ||
stale: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/stale@v9 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: 'This issue is inactive for a long time.' | ||
stale-pr-message: 'This PR is inactive for a long time' | ||
stale-issue-label: 'inactive-issue' | ||
stale-pr-label: 'inactive-pr' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 单元测试 | ||
.PHONY: ut | ||
ut: | ||
@go test -race ./... | ||
|
||
.PHONY: setup | ||
setup: | ||
@sh ./script/setup.sh | ||
|
||
.PHONY: lint | ||
lint: | ||
golangci-lint run | ||
|
||
.PHONY: fmt | ||
fmt: | ||
@sh ./script/fmt.sh | ||
|
||
.PHONY: tidy | ||
tidy: | ||
@go mod tidy -v | ||
|
||
.PHONY: check | ||
check: | ||
@$(MAKE) --no-print-directory fmt | ||
@$(MAKE) --no-print-directory tidy | ||
|
||
.PHONY: e2e_up | ||
e2e_up: | ||
docker-compose -f script/integration_test_compose.yml up -d | ||
|
||
.PHONY: e2e_down | ||
e2e_down: | ||
docker-compose -f script/integration_test_compose.yml down -v |
Oops, something went wrong.