Skip to content

Commit

Permalink
feat: pr template
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvanstack committed Oct 16, 2023
1 parent 63ef121 commit 2cb17ff
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: 报告缺陷 Bug Report
about: 报告缺陷以帮助我们改进 Report defects to help us improve
---

### 描述问题 Describe the problem

<!--
请尽量清晰精准地描述你碰到的问题。
Please describe your problem as clearly and accurately as possible.
-->

````````markdown
如果是解析渲染问题的话请在此处贴入 Markdown 原文
If it is a problem of parsing and rendering, please post the original Markdown here
````````

### 期待的结果 Expected result

<!--
请尽量清晰精准地描述你所期待的结果。
Please be as clear and accurate as possible to describe the results you are looking for.
-->

### 截屏或录像 Screenshot or video

<!--
如果可能,请尽量附加截图或录像来描述你遇到的问题。
If possible, please try to attach screenshots or videos to describe the problem you are experiencing.
(Windows 下推荐使用 [Screen2Gif](https://www.screentogif.com/) 进行录屏。如果是编辑器输入相关问题,使用 Screen2Gif 录制结束后请打开`图像 - 按键`)
(It is recommended to use [Screen2Gif](https://www.screentogif.com/) to record the screen under Windows. If it is related to the editor input, please open the `Image - Key Strokes` after recording with Screen2Gif)
-->

### 版本环境 Version environment

* 版本 Version:
* 操作系统 Operating system:
* 浏览器(如果使用)Browser (if used):

### 其他信息 Other information

<!--
请提供其他附加信息帮助我们诊断问题。
Please provide other additional information to help us diagnose the problem.
-->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Jarvan的博客
url: https://jarvans.com
about: 大厂程序员, 公众号 硬核的Jarvan
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: 请求新功能 Request new features
about: 提出你期待的功能特性 Come up with the features you expect
---

### 你在什么场景下需要该功能? In what scenarios do you need this function?

<!--
请尽量清晰精准地描述你期待的功能和应用场景。
Please describe the functions and application scenarios you expect as clearly and accurately as possible.
-->

### 描述最优的解决方案 Describe the optimal solution

<!--
请尝试描述最优的解决方案,也许已经有类似软件实现了该特性,也请列出给我们参考。
Please try to describe the best solution. There may be similar software that implements this feature. Please also list it for our reference.
-->

### 描述候选解决方案 Describe the candidate solution

<!--
请尽量清晰精准地描述你能接受的候选解决方案。
Please describe the candidate solutions you can accept as clearly and accurately as possible.
-->

### 其他信息 Other information

<!--
请提供关于该功能建议的其他附加信息。
Please provide any additional information about this feature suggestion.
-->
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!--
* PR 请提交到 dev 开发分支上
-->
27 changes: 27 additions & 0 deletions .github/workflows/go-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Go package

on: [push]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.15'

- name: Build
run: go build -v ./...

- name: Test
run: go test -json > TestResults-${{ matrix.go-version }}.json
- name: Upload Go test results
uses: actions/upload-artifact@v3
with:
name: Go-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.json
retention-days: 5
55 changes: 55 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: golangci-lint
on:
push:
branches:
- master
- main
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/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --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 all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
131 changes: 131 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Copyright 2020 Lingfei Kong <[email protected]>. All rights reserved.
# Use of this source code is governed by a MIT style
# license that can be found in the LICENSE file.

# This file contains all available configuration options
# with their default values.

# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# list of build tags, all linters use it. Default is empty list.
build-tags:
- mytag

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- test # 测试目录
- tools # 工具目录

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- ".*\\.my\\.go$"
- _test.go

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
#modules-download-mode: release|readonly|vendor

# Allow multiple parallel golangci-lint instances running.
# If false (default) - golangci-lint acquires file lock on start.
allow-parallel-runners: true


# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

# make issues output unique by line, default is true
uniq-by-line: true

# add a prefix to the output file references; default is no prefix
path-prefix: ""

# sorts results by: filepath, line and column
sort-results: true

# all available settings of specific linters
linters-settings:
gocyclo:
# Minimal code complexity to report.
# Default: 30 (but we recommend 10-20)
min-complexity: 10
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
# enable-all: true
disable-all: true
enable:
- typecheck # 类型检查
- bodyclose # body是否关闭
- durationcheck # duration相乘检查
- errcheck # 错误检查
- exportloopref # 循环指针检查
# - gofmt # gofmt
# - gofumpt # gofumpt
# - goimports # 导包顺序检查
# - gosec # go安全检查
- gosimple # 简化代码检查
- govet
- ineffassign # 变量是否未被使用
- makezero # make非0长度切片
- nilerr
#- prealloc # 切片预分配
#- revive 冗余代码检查
- staticcheck # 静态检查
- unparam # 无用的参数
- unused # 变量是否使用
- errchkjson # json err是否处理
- gocyclo # 圈复杂度检查
fast: false

issues:

# Show only new issues created after git revision `REV`
# new-from-rev: REV

# Show only new issues created in git patch with set file path.
#new-from-patch: path/to/patch/file

# Fix found issues (if it's supported by the linter)
fix: false


0 comments on commit 2cb17ff

Please sign in to comment.