Skip to content

Commit e2b4660

Browse files
committed
initial commit
0 parents  commit e2b4660

File tree

18 files changed

+901
-0
lines changed

18 files changed

+901
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = tab
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{yaml,yml,md,mdx}]
12+
indent_style = space

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: 'github-actions'
5+
directory: '/'
6+
schedule:
7+
day: 'sunday'
8+
interval: 'weekly'
9+
groups:
10+
github-actions:
11+
patterns:
12+
- '*'
13+
14+
- package-ecosystem: 'gomod'
15+
directory: '/'
16+
schedule:
17+
day: 'sunday'
18+
interval: 'weekly'
19+
groups:
20+
gomod-security:
21+
applies-to: security-updates
22+
patterns: ['*']
23+
gomod-update:
24+
applies-to: version-updates
25+
patterns: ['*']

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Releases Tag
2+
3+
on:
4+
push:
5+
tags:
6+
- v*.*.*
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version-file: go.mod
23+
24+
- uses: goreleaser/goreleaser-action@v6
25+
with:
26+
version: latest
27+
args: release --clean
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test Branch
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
test:
15+
name: test
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version-file: go.mod
23+
24+
- uses: gotesttools/gotestfmt-action@v2
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- uses: golangci/golangci-lint-action@v6
29+
with:
30+
version: latest
31+
32+
- run: make test
33+
34+
# TODO enable once we have tests
35+
# - uses: coverallsapp/github-action@v2
36+
# with:
37+
# file: coverage.out
38+

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.*
2+
*.zip
3+
*.tar
4+
*.out
5+
*.log
6+
/bin/
7+
/tmp/
8+
9+
## Git
10+
!.gitkeep
11+
!.gitignore
12+
13+
## GitHub
14+
!.github/
15+
16+
## Editorconfig
17+
!.editorconfig
18+
19+
## Husky
20+
!.husky/
21+
!.husky.yaml
22+
23+
## Golang
24+
!.golangci.yml
25+
!.goreleaser.yml

.golangci.yml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
run:
2+
timeout: 5m
3+
4+
issues:
5+
exclude-dirs:
6+
- 'tmp'
7+
8+
linters-settings:
9+
# https://golangci-lint.run/usage/linters/#misspell
10+
misspell:
11+
mode: restricted
12+
# https://golangci-lint.run/usage/linters/#asasalint
13+
asasalint:
14+
ignore-test: true
15+
# https://golangci-lint.run/usage/linters/#exhaustive
16+
exhaustive:
17+
default-signifies-exhaustive: true
18+
# https://golangci-lint.run/usage/linters/#predeclared
19+
predeclared:
20+
ignore: "new,error"
21+
# https://golangci-lint.run/usage/linters/#gocritic
22+
gocritic:
23+
disabled-checks:
24+
- ifElseChain
25+
- commentFormatting
26+
# https://golangci-lint.run/usage/linters/#testifylint
27+
testifylint:
28+
disable:
29+
- float-compare
30+
# https://golangci-lint.run/usage/linters/#gosec
31+
gosec:
32+
confidence: medium
33+
# https://golangci-lint.run/usage/linters/#importas
34+
importas:
35+
no-unaliased: true
36+
# https://golangci-lint.run/usage/linters/#gomoddirectives
37+
gomoddirectives:
38+
replace-local: true
39+
# https://golangci-lint.run/usage/linters/#revive
40+
revive:
41+
ignore-generated-header: true
42+
enable-all-rules: true
43+
rules:
44+
- name: line-length-limit
45+
disabled: true
46+
- name: cognitive-complexity
47+
disabled: true
48+
- name: unused-parameter
49+
disabled: true
50+
- name: add-constant
51+
disabled: true
52+
- name: cyclomatic
53+
disabled: true
54+
- name: function-length
55+
disabled: true
56+
- name: function-result-limit
57+
disabled: true
58+
- name: flag-parameter
59+
disabled: true
60+
- name: unused-receiver
61+
disabled: true
62+
- name: argument-limit
63+
disabled: true
64+
- name: max-control-nesting
65+
disabled: true
66+
- name: comment-spacings
67+
disabled: true
68+
- name: struct-tag
69+
arguments:
70+
- "json,inline"
71+
- "yaml,squash"
72+
- name: unhandled-error
73+
arguments:
74+
- "fmt.Println"
75+
76+
linters:
77+
disable-all: true
78+
enable:
79+
## Enabled by default linters:
80+
- errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
81+
- gosimple # (megacheck) Linter for Go source code that specializes in simplifying code [fast: false, auto-fix: false]
82+
- govet # (vet, vetshadow) Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [fast: false, auto-fix: false]
83+
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
84+
- staticcheck # (megacheck) It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false]
85+
- unused # (megacheck) Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
86+
87+
## Disabled by your configuration linters:
88+
- asasalint # check for pass []any as any in variadic func(...any) [fast: false, auto-fix: false]
89+
- asciicheck # checks that all code identifiers does not have non-ASCII symbols in the name [fast: true, auto-fix: false]
90+
- bidichk # Checks for dangerous unicode character sequences [fast: true, auto-fix: false]
91+
- bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]
92+
- containedctx # containedctx is a linter that detects struct contained context.Context field [fast: false, auto-fix: false]
93+
- contextcheck # check whether the function uses a non-inherited context [fast: false, auto-fix: false]
94+
- copyloopvar # (go >= 1.22) copyloopvar is a linter detects places where loop variables are copied [fast: true, auto-fix: false]
95+
- decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
96+
- durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
97+
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted. [fast: false, auto-fix: false]
98+
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false]
99+
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]
100+
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
101+
- exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false]
102+
- forbidigo # Forbids identifiers [fast: false, auto-fix: false]
103+
- forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
104+
- gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid. [fast: true, auto-fix: false]
105+
- gochecksumtype # Run exhaustiveness checks on Go "sum types" [fast: false, auto-fix: false]
106+
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
107+
- gocritic # Provides diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: true]
108+
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
109+
- goheader # Checks is file header matches to pattern [fast: true, auto-fix: true]
110+
- goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. [fast: true, auto-fix: true]
111+
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
112+
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false]
113+
- goprintffuncname # Checks that printf-like functions are named with `f` at the end. [fast: true, auto-fix: false]
114+
- gosec # (gas) Inspects source code for security problems [fast: false, auto-fix: false]
115+
- gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase [fast: false, auto-fix: false]
116+
- grouper # Analyze expression groups. [fast: true, auto-fix: false]
117+
- importas # Enforces consistent import aliases [fast: false, auto-fix: false]
118+
- inamedparam # reports interfaces with unnamed method parameters [fast: true, auto-fix: false]
119+
- intrange # (go >= 1.22) intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false]
120+
- loggercheck # (logrlint) Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). [fast: false, auto-fix: false]
121+
- makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
122+
- misspell # Finds commonly misspelled English words [fast: true, auto-fix: true]
123+
- mirror # reports wrong mirror patterns of bytes/strings usage [fast: false, auto-fix: true]
124+
- musttag # enforce field tags in (un)marshaled structs [fast: false, auto-fix: false]
125+
- nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero). [fast: true, auto-fix: false]
126+
- nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
127+
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
128+
- noctx # Finds sending http request without context.Context [fast: false, auto-fix: false]
129+
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: true]
130+
- nonamedreturns # Reports all named returns [fast: false, auto-fix: false]
131+
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]
132+
- paralleltest # Detects missing usage of t.Parallel() method in your Go test [fast: false, auto-fix: false]
133+
- predeclared # find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false]
134+
- promlinter # Check Prometheus metrics naming via promlint [fast: true, auto-fix: false]
135+
- reassign # Checks that package variables are not reassigned [fast: false, auto-fix: false]
136+
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
137+
- rowserrcheck # checks whether Rows.Err of rows is checked successfully [fast: false, auto-fix: false]
138+
- spancheck # Checks for mistakes with OpenTelemetry/Census spans. [fast: false, auto-fix: false]
139+
- sqlclosecheck # Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed. [fast: false, auto-fix: false]
140+
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
141+
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
142+
- testableexamples # linter checks if examples are testable (have an expected output) [fast: true, auto-fix: false]
143+
- testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]
144+
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
145+
- thelper # thelper detects tests helpers which is not start with t.Helper() method. [fast: false, auto-fix: false]
146+
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes. [fast: false, auto-fix: false]
147+
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
148+
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]
149+
- wastedassign # Finds wasted assignment statements [fast: false, auto-fix: false]
150+
- whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc. [fast: true, auto-fix: true]
151+
152+
## Don't enable
153+
#- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
154+
#- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
155+
#- dupl # Tool for code clone detection [fast: true, auto-fix: false]
156+
#- dupword # checks for duplicate words in the source code [fast: true, auto-fix: false]
157+
#- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
158+
#- err113 # Go linter to check the errors handling expressions [fast: false, auto-fix: false]
159+
#- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
160+
#- gci # Gci controls Go package import order and makes it always deterministic. [fast: true, auto-fix: true]
161+
#- gochecknoglobals # Check that no global variables exist. [fast: false, auto-fix: false]
162+
#- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
163+
#- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
164+
#- godot # Check if comments end in a period [fast: true, auto-fix: true]
165+
#- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
166+
#- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
167+
#- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
168+
#- ginkgolinter # enforces standards of using ginkgo and gomega [fast: false, auto-fix: false]
169+
#- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
170+
#- interfacebloat # A linter that checks the number of methods inside an interface. [fast: true, auto-fix: false]
171+
#- lll # Reports long lines [fast: true, auto-fix: false]
172+
#- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
173+
#- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
174+
#- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
175+
#- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]
176+
#- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative. [fast: false, auto-fix: false]
177+
#- prealloc # Finds slice declarations that could potentially be pre-allocated [fast: true, auto-fix: false]
178+
#- protogetter # Reports direct reads from proto message fields when getters should be used [fast: false, auto-fix: true]
179+
#- sloglint # ensure consistent code style when using log/slog [fast: false, auto-fix: false]
180+
#- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true]
181+
#- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
182+
#- unparam # Reports unused function parameters [fast: false, auto-fix: false]
183+
#- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
184+
#- wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
185+
#- wsl # add or remove empty lines [fast: true, auto-fix: false]
186+
#- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]

.goreleaser.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
3+
builds:
4+
- skip: true
5+
6+
release:
7+
prerelease: auto
8+
9+
changelog:
10+
use: github-native

.husky.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
hooks:
2+
pre-commit:
3+
- golangci-lint run --fast
4+
- husky lint-staged
5+
commit-msg:
6+
# only execute if not in a merge
7+
- if [[ -z $(git rev-parse -q --verify MERGE_HEAD) ]]; then husky lint-commit; fi
8+
9+
lint-staged:
10+
'*.go':
11+
- goimports -l -w
12+
13+
lint-commit:
14+
types: '^(feat|fix|build|chore|docs|perf|refactor|revert|style|test|wip)$'
15+
header: '^(?P<type>\w+)(\((?P<scope>[\w/.-]+)\))?(?P<breaking>!)?:( +)?(?P<header>.+)'

0 commit comments

Comments
 (0)