forked from bxcodec/go-clean-arch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: linting and cleanup (bxcodec#70)
* chore: cleanup project * chore: delete unused file * chore: update README * chore: fix typo * chore: add github action * chore: add github action * chore: rename the file * chore: try GH action * chore: fix docker compose
- Loading branch information
Showing
21 changed files
with
503 additions
and
155 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,37 @@ | ||
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format | ||
|
||
# Working directory | ||
# . or absolute path, please note that the directories following must be under root | ||
root = "." | ||
tmp_dir = "tmp_app" | ||
|
||
[build] | ||
# Just plain old shell command. You could use `make` as well. | ||
cmd = "go build -o ./tmp_app/app/engine ./app/." | ||
# Binary file yields from `cmd`. | ||
bin = "tmp_app/app" | ||
# Customize binary. | ||
full_bin = "./tmp_app/app/engine" | ||
# This log file places in your tmp_dir. | ||
log = "air_errors.log" | ||
# Watch these filename extensions. | ||
include_ext = ["go", "yaml", "toml"] | ||
# Ignore these filename extensions or directories. | ||
exclude_dir = ["tmp_app", "tmp"] | ||
# It's not necessary to trigger build each time file changes if it's too frequent. | ||
delay = 1000 # ms | ||
|
||
[log] | ||
# Show log time | ||
time = true | ||
|
||
[color] | ||
# Customize each part's color. If no color found, use the raw app log. | ||
main = "magenta" | ||
watcher = "cyan" | ||
build = "yellow" | ||
runner = "green" | ||
|
||
[misc] | ||
# Delete tmp directory on exit | ||
clean_on_exit = 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,2 @@ | ||
engine | ||
*.out |
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,24 @@ | ||
name: Go Test | ||
|
||
on: | ||
push: | ||
branches: ["main", "chore/upgrade-linter"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: Linter | ||
run: make lint | ||
|
||
- name: Test | ||
run: make tests |
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ _* | |
*.test | ||
.DS_Store | ||
engine | ||
bin/ | ||
bin/ | ||
*.out |
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 |
---|---|---|
@@ -1,80 +1,130 @@ | ||
govet: | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
golint: | ||
min-confidence: 0.8 | ||
gocyclo: | ||
min-complexity: 20 | ||
maligned: | ||
suggest-new: true | ||
dupl: | ||
threshold: 100 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 5 | ||
misspell: | ||
locale: US | ||
lll: | ||
line-length: 160 | ||
# tab width in spaces. Default to 1. | ||
tab-width: 1 | ||
funlen: | ||
lines: 120 | ||
statements: 50 | ||
linters-settings: | ||
dupl: | ||
threshold: 300 | ||
funlen: | ||
lines: 200 | ||
statements: 55 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- performance | ||
- style | ||
- opinionated | ||
disabled-checks: | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
- wrapperFunc | ||
- hugeParam | ||
gocyclo: | ||
min-complexity: 20 | ||
gomnd: | ||
# don't include the "operation" and "assign" | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- return | ||
ignored-numbers: | ||
- "0" | ||
- "1" | ||
- "2" | ||
- "3" | ||
ignored-functions: | ||
- strings.SplitN | ||
govet: | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
lll: | ||
line-length: 160 | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
|
||
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 | ||
disable-all: true | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- funlen | ||
- goconst | ||
# - gocritic | ||
- gocyclo | ||
- golint | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- interfacer | ||
- lll | ||
- misspell | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
# - deadcode | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- funlen | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- noctx | ||
# - nolintlint | ||
- staticcheck | ||
# - structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- revive | ||
# - varcheck | ||
- whitespace | ||
|
||
run: | ||
# default concurrency is a available CPU number | ||
concurrency: 2 | ||
|
||
skip-dirs: | ||
# - test/testdata_etc | ||
skip-files: | ||
# - .*_test.go | ||
# don't enable: | ||
# | ||
# - scopelint | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godot | ||
# - godox | ||
# - goerr113 | ||
# - interfacer | ||
# - maligned | ||
# - nestif | ||
# - prealloc | ||
# - testpackage | ||
# - wsl | ||
|
||
issues: | ||
exclude-rules: | ||
- path: internal/(cache|renameio)/ | ||
linters: | ||
- lll | ||
- gochecknoinits | ||
- gocyclo | ||
- funlen | ||
- path: .*_test.go | ||
linters: | ||
- funlen | ||
exclude-use-default: false | ||
exclude: | ||
- should have a package comment | ||
# Excluding configuration per-path, per-linter, per-text and per-source | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gomnd | ||
- dupl | ||
- goconst | ||
|
||
# - path: pkg/xerrors/xerrors.go | ||
# text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" | ||
- path: app | ||
text: "don't use `init` function" | ||
run: | ||
timeout: 5m | ||
go: "1.17" | ||
skip-dirs: | ||
# - */mocks |
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
Oops, something went wrong.