Skip to content

Commit 1eded46

Browse files
Refactor whole app
1 parent b2919f5 commit 1eded46

Some content is hidden

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

47 files changed

+1032
-1520
lines changed

.github/workflows/build-base.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Build Base"
2+
3+
on:
4+
workflow_call:
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
go: ["1.21"]
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 1
15+
- uses: actions/setup-go@v4
16+
with:
17+
go-version: ${{ matrix.go }}
18+
- name: Install Task
19+
uses: arduino/setup-task@v1
20+
with:
21+
version: 3.x
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Build
24+
run: |
25+
task build

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Build"
2+
3+
on:
4+
push:
5+
paths:
6+
- "cmd/**"
7+
- "pkg/**"
8+
- "main.go"
9+
branches:
10+
- main
11+
- develop
12+
pull_request:
13+
paths:
14+
- "cmd/**"
15+
- "pkg/**"
16+
- "main.go"
17+
branches:
18+
- main
19+
- develop
20+
jobs:
21+
build:
22+
uses: "./.github/workflows/build-base.yml"

.github/workflows/lint.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1+
name: 'GolangCI Lint'
2+
13
on:
2-
pull_request:
4+
push:
5+
paths:
6+
- 'cmd/**'
7+
- 'pkg/**'
8+
- 'main.go'
39
branches:
4-
- master
10+
- main
511
- develop
6-
workflow_call:
7-
push:
12+
pull_request:
13+
paths:
14+
- 'cmd/**'
15+
- 'pkg/**'
16+
- 'main.go'
817
branches:
9-
- master
18+
- main
1019
- develop
1120
jobs:
12-
golangci-lint:
21+
lint:
1322
runs-on: ubuntu-latest
1423
steps:
15-
- name: Check out code into the Go module directory
16-
uses: actions/checkout@v2
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 1
1727
- name: golangci-lint
1828
uses: reviewdog/action-golangci-lint@v2
1929
with:

.github/workflows/test.yml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
1-
name: 'Tests'
1+
name: "Testing"
22

33
on:
44
push:
5+
paths:
6+
- "cmd/**"
7+
- "pkg/**"
8+
- "main.go"
59
branches:
610
- master
7-
- develop
811
pull_request:
12+
paths:
13+
- "cmd/**"
14+
- "pkg/**"
15+
- "main.go"
916
branches:
1017
- master
11-
- develop
18+
1219
jobs:
1320
unit-tests:
1421
strategy:
1522
matrix:
16-
go: [ 1.20 ]
23+
go: ["1.21"]
1724
runs-on: ubuntu-latest
1825
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v3
21-
- uses: actions/setup-go@v3
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 1
29+
- uses: actions/setup-go@v4
2230
with:
2331
go-version: ${{ matrix.go }}
24-
- uses: actions/cache@v3
32+
- name: Install Task
33+
uses: arduino/setup-task@v1
2534
with:
26-
path: |
27-
~/.cache/go-build
28-
~/go/pkg/mod
29-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30-
restore-keys: |
31-
${{ runner.os }}-go-
32-
- name: Set up gotestfmt
33-
run: go install gotesttools/gotestfmt@latest
35+
version: 3.x
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
3437
- name: Run tests
3538
run: |
39+
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
3640
cp config.example.yml config.yml
37-
go test -covermode=atomic -coverprofile=coverage.txt -timeout 5m -json -v ./... | gotestfmt -showteststatus
38-
- uses: codecov/codecov-action@v1
39-
with:
40-
token: ${{ secrets.CODECOV_TOKEN }}
41-
file: ./coverage.txt
42-
flags: tests
43-
name: codecov-umbrella
44-
fail_ci_if_error: true
45-
verbose: true
41+
task test

.golangci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
run:
2+
concurrency: 16
3+
timeout: 5m
4+
issues-exit-code: 1
5+
tests: true
6+
7+
skip-dirs:
8+
- docs/
9+
10+
skip-files:
11+
- "*_gen\\.go$"
12+
13+
modules-download-mode: mod
14+
allow-parallel-runners: true
15+
go: '1.21'
16+
17+
output:
18+
format: colored-line-number
19+
print-issued-lines: true
20+
print-linter-name: true
21+
uniq-by-line: true
22+
sort-results: true
23+
24+
linters:
25+
disable-all: true
26+
enable:
27+
- asasalint
28+
- bidichk
29+
- bodyclose
30+
- decorder
31+
- dupl
32+
- durationcheck
33+
- errcheck
34+
- errchkjson
35+
- errname
36+
- errorlint
37+
- exportloopref
38+
- forbidigo
39+
- gofumpt
40+
- ginkgolinter
41+
- gocheckcompilerdirectives
42+
- gochecknoglobals
43+
- gocognit
44+
- goconst
45+
- gocritic
46+
- gocyclo
47+
- godox
48+
- goerr113
49+
- goheader
50+
- goimports
51+
- gomodguard
52+
- goprintffuncname
53+
- gosec
54+
- gosimple
55+
- gosmopolitan
56+
- govet
57+
- grouper
58+
- importas
59+
- ineffassign
60+
- interfacebloat
61+
- loggercheck
62+
- maintidx
63+
- makezero
64+
- mirror
65+
- misspell
66+
- nakedret
67+
- nestif
68+
- nilerr
69+
- nilnil
70+
- noctx
71+
- nolintlint
72+
- nonamedreturns
73+
- nosprintfhostport
74+
- paralleltest
75+
- prealloc
76+
- predeclared
77+
- promlinter
78+
- reassign
79+
- revive
80+
- rowserrcheck
81+
- sqlclosecheck
82+
- staticcheck
83+
- stylecheck
84+
- tenv
85+
- testableexamples
86+
- testpackage
87+
- thelper
88+
- tparallel
89+
- unconvert
90+
- unparam
91+
- unused
92+
- usestdlibvars
93+
- wastedassign
94+
- whitespace
95+
- zerologlint
96+
- prealloc
97+
- perfsprint

.vscode/extensions.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"recommendations": [
3+
"task.vscode-task",
4+
"rogalmic.bash-debug",
5+
"mads-hartmann.bash-ide-vscode",
6+
"ms-vscode-remote.remote-containers",
7+
"ms-azuretools.vscode-docker",
8+
"p1c2u.docker-compose",
9+
"usernamehw.errorlens",
10+
"github.vscode-github-actions",
11+
"eamodio.gitlens",
12+
"golang.go",
13+
"mongodb.mongodb-vscode",
14+
"christian-kohler.path-intellisense",
15+
"uniquevision.vscode-plpgsql-lsp",
16+
"foxundermoon.shell-format",
17+
"timonwong.shellcheck",
18+
"mtxr.sqltools",
19+
"JordanHury.sqltools-cassandra",
20+
"mtxr.sqltools-driver-pg",
21+
"wayou.vscode-todo-highlight",
22+
"tooltitudeteam.tooltitude",
23+
"pflannery.vscode-versionlens",
24+
"zxh404.vscode-proto3",
25+
"redhat.vscode-yaml",
26+
"ms-vscode.test-adapter-converter",
27+
"GitHub.vscode-pull-request-github",
28+
"ms-vscode.remote-repositories",
29+
"ms-vsliveshare.vsliveshare",
30+
"aaron-bond.better-comments"
31+
]
32+
}

.vscode/launch.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "Debug Boilerplate Server",
5+
"name": "Debug Server",
66
"type": "go",
77
"request": "attach",
88
"mode": "remote",
@@ -11,19 +11,12 @@
1111
"host": "127.0.0.1"
1212
},
1313
{
14-
"name": "Debug Boilerplate",
14+
"name": "Debug",
1515
"type": "go",
1616
"request": "launch",
1717
"mode": "debug",
1818
"program": "main.go",
19-
"args": [
20-
"serve",
21-
"--env",
22-
"development",
23-
"--log-level",
24-
"debug",
25-
"--log-pretty-print"
26-
]
19+
"args": ["serve"]
2720
},
2821
{
2922
"name": "Attach to Process",

0 commit comments

Comments
 (0)