From 0a91abc605adec38dfd01809e621b1592ccd6afc Mon Sep 17 00:00:00 2001 From: Yuri Solyanik Date: Sun, 27 Aug 2023 14:23:03 +0500 Subject: [PATCH] Add code from PR #11 - Add linter config file add description --- .golangci.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 9 ++++++++ 2 files changed, 68 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..bdd5e5f --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,59 @@ +linters-settings: + errcheck: + check-type-assertions: true + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + govet: + check-shadowing: false + nolintlint: + require-explanation: true + require-specific: true + +linters: + disable-all: true + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - gocritic + - gofmt + - goimports + - gocyclo + - gosec + - gosimple + - govet + - ineffassign + - nolintlint + - nakedret + - prealloc + - predeclared + - revive + - staticcheck + - structcheck + - stylecheck + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - varcheck + - whitespace + - goconst + - wsl + - misspell + +run: + issues-exit-code: 1 diff --git a/README.md b/README.md index eebfa61..49d30d9 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,15 @@ Whenever you make changes in the interfaces of these use-cases, repositories, or } ``` +### Linter "must have" +[How to](https://golangci-lint.run/usage/install/) install golangci-lint. His project [main](https://golangci-lint.run/) page. Default config [file](.golangci.yml). +Add to IDE: +- Goland [plugin](https://github.com/xxpxxxxp/intellij-plugin-golangci-lint) +- vscode (ctrl+shift+p -> settings.json): +```json +"go.lintTool": "golangci-lint", +``` + ### TODO - Improvement based on feedback.