Skip to content

Commit 62dd8e4

Browse files
committed
Initial commit
0 parents  commit 62dd8e4

Some content is hidden

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

50 files changed

+11342
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: nao1215
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Desktop (please complete the following information):**
20+
- OS: [e.g. Ubuntu]
21+
- Go Version [e.g. 1.17]
22+
- Library Version [e.g. 1.0.1]

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "20:00"
8+
open-pull-requests-limit: 10
9+
# Maintain dependencies for GitHub Actions
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "daily"

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v6
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Extract tag name
21+
id: tag
22+
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
23+
24+
- name: Extract changelog for this version
25+
id: changelog
26+
run: |
27+
# Extract the current version's changelog
28+
TAG="${{ steps.tag.outputs.TAG_NAME }}"
29+
TAG_WITHOUT_V="${TAG#v}"
30+
31+
# Create a temporary file for the changelog content
32+
CHANGELOG_FILE="changelog_content.md"
33+
34+
# Extract content between the current version and the next version header
35+
# This handles different possible formats: ## [x.y.z], ## x.y.z, ### [x.y.z], ### x.y.z
36+
awk -v ver="$TAG_WITHOUT_V" '
37+
BEGIN { found = 0; }
38+
$0 ~ "^#{2,3} \\[?" ver "\\]?" { found = 1; next; }
39+
/^#{2,3} \[?[0-9]+\.[0-9]+\.[0-9]+\]?/ { if (found) exit; }
40+
found { print; }
41+
' CHANGELOG.md > "$CHANGELOG_FILE"
42+
43+
# If no content found with version without 'v', try with 'v'
44+
if [ ! -s "$CHANGELOG_FILE" ]; then
45+
awk -v ver="$TAG" '
46+
BEGIN { found = 0; }
47+
$0 ~ "^#{2,3} \\[?" ver "\\]?" { found = 1; next; }
48+
/^#{2,3} \[?v?[0-9]+\.[0-9]+\.[0-9]+\]?/ { if (found) exit; }
49+
found { print; }
50+
' CHANGELOG.md > "$CHANGELOG_FILE"
51+
fi
52+
53+
# If still no content, use a default message
54+
if [ ! -s "$CHANGELOG_FILE" ]; then
55+
echo "No changelog entry found for version $TAG" > "$CHANGELOG_FILE"
56+
echo ""
57+
echo "Please check CHANGELOG.md for updates." >> "$CHANGELOG_FILE"
58+
fi
59+
60+
# Set the output
61+
{
62+
echo 'CHANGELOG_CONTENT<<EOF'
63+
cat "$CHANGELOG_FILE"
64+
echo 'EOF'
65+
} >> "$GITHUB_OUTPUT"
66+
67+
- name: Create Release
68+
uses: softprops/action-gh-release@v2
69+
with:
70+
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
71+
name: ${{ steps.tag.outputs.TAG_NAME }}
72+
body: ${{ steps.changelog.outputs.CHANGELOG_CONTENT }}
73+
draft: false
74+
prerelease: ${{ contains(steps.tag.outputs.TAG_NAME, '-alpha') || contains(steps.tag.outputs.TAG_NAME, '-beta') || contains(steps.tag.outputs.TAG_NAME, '-rc') }}
75+
generate_release_notes: false
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reviewdog.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: reviewdog
2+
on: [pull_request]
3+
4+
jobs:
5+
golangci-lint:
6+
name: golangci-lint
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
steps:
10+
- name: Check out code into the Go module directory
11+
uses: actions/checkout@v6
12+
with:
13+
persist-credentials: false
14+
- name: golangci-lint
15+
uses: reviewdog/action-golangci-lint@v2
16+
with:
17+
golangci_lint_flags: "--timeout 10m"
18+
reporter: github-pr-review
19+
level: warning
20+
21+
misspell:
22+
name: misspell
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
steps:
26+
- name: Check out code into the Go module directory
27+
uses: actions/checkout@v6
28+
with:
29+
persist-credentials: false
30+
- name: misspell
31+
uses: reviewdog/action-misspell@v1
32+
with:
33+
reporter: github-pr-review
34+
level: warning
35+
locale: "US"
36+
exclude: ./doc/*
37+
38+
actionlint:
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 10
41+
steps:
42+
- uses: actions/checkout@v6
43+
- uses: reviewdog/action-actionlint@v1
44+
with:
45+
reporter: github-pr-review
46+
level: warning

.github/workflows/unit_test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: MultiPlatformUnitTest
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
unit_test:
12+
name: Unit test (linux)
13+
14+
strategy:
15+
matrix:
16+
os:
17+
- "ubuntu-latest"
18+
- "windows-latest"
19+
- "macos-latest"
20+
go:
21+
- "1.24"
22+
- "1.25"
23+
fail-fast: false
24+
runs-on: ${{ matrix.os }}
25+
timeout-minutes: 10
26+
27+
steps:
28+
- uses: actions/checkout@v6
29+
30+
- uses: actions/setup-go@v6
31+
with:
32+
go-version: ${{ matrix.go }}
33+
34+
- name: Run tests with coverage report output
35+
run: go test -cover -coverpkg=./... -coverprofile=coverage.out ./...
36+

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Code coverage profiles and other test artifacts
15+
*.out
16+
coverage.*
17+
*.coverprofile
18+
profile.cov
19+
20+
# Dependency directories (remove the comment below to include it)
21+
# vendor/
22+
23+
# Go workspace file
24+
go.work
25+
go.work.sum
26+
27+
# env file
28+
.env
29+
30+
# Editor/IDE
31+
# .idea/
32+
# .vscode/
33+
/cover*

.golangci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
version: "2"
2+
run:
3+
go: "1.24"
4+
linters:
5+
enable:
6+
- asciicheck
7+
- bidichk
8+
- bodyclose
9+
- canonicalheader
10+
- containedctx
11+
- copyloopvar
12+
- decorder
13+
- dogsled
14+
- durationcheck
15+
- errchkjson
16+
- errname
17+
- errorlint
18+
- fatcontext
19+
- forcetypeassert
20+
- gocheckcompilerdirectives
21+
- gochecknoinits
22+
- goconst
23+
- gomoddirectives
24+
- gosec
25+
- interfacebloat
26+
- intrange
27+
- makezero
28+
- mirror
29+
- misspell
30+
- nakedret
31+
- nilerr
32+
- noctx
33+
- nolintlint
34+
- nosprintfhostport
35+
- perfsprint
36+
- prealloc
37+
- predeclared
38+
- reassign
39+
- revive
40+
- rowserrcheck
41+
- sloglint
42+
- sqlclosecheck
43+
- staticcheck
44+
- tagliatelle
45+
- thelper
46+
- unconvert
47+
- unparam
48+
- usestdlibvars
49+
- usetesting
50+
- wastedassign
51+
- whitespace
52+
settings:
53+
errcheck:
54+
disable-default-exclusions: false
55+
check-type-assertions: true
56+
check-blank: true
57+
tagliatelle:
58+
case:
59+
rules:
60+
json: snake
61+
use-field-name: true
62+
exclusions:
63+
generated: lax
64+
rules:
65+
- linters:
66+
- goconst
67+
path: .*_test\.go
68+
- linters:
69+
- errcheck
70+
source: defer
71+
- linters:
72+
- gochecknoinits
73+
path: filesql\.go
74+
source: func init\(\)
75+
- path: (.+)\.go$
76+
text: fmt.Fprintf
77+
- path: (.+)\.go$
78+
text: fmt.Fprintln
79+
- path: (.+)\.go$
80+
text: fmt.Fprint
81+
- path: (.+)\.go$
82+
text: fmt.Printf
83+
- path: (.+)\.go$
84+
text: fmt.Sscanf
85+
- path: (.+)\.go$
86+
text: buf.WriteByte
87+
- path: (.+)\.go$
88+
text: buf.WriteRune
89+
- path: (.+)\.go$
90+
text: Close
91+
paths:
92+
- third_party$
93+
- builtin$
94+
- examples$
95+
issues:
96+
max-same-issues: 0
97+
formatters:
98+
enable:
99+
- gofmt
100+
- goimports
101+
exclusions:
102+
generated: lax
103+
paths:
104+
- third_party$
105+
- builtin$
106+
- examples$

.octocov.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# generated by octocov init
2+
coverage:
3+
if: true
4+
acceptable: 80%
5+
diff:
6+
datastores:
7+
- artifact://${GITHUB_REPOSITORY}
8+
comment:
9+
if: is_pull_request
10+
hideFooterLink: false
11+
summary:
12+
if: true
13+
report:
14+
if: is_default_branch
15+
datastores:
16+
- artifact://${GITHUB_REPOSITORY}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]

0 commit comments

Comments
 (0)