fix: linter
This commit is contained in:
+21
-65
@@ -5,20 +5,32 @@ linters:
|
|||||||
enable:
|
enable:
|
||||||
- govet
|
- govet
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- unused
|
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- typecheck
|
- typecheck
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- gofmt
|
- gofmt
|
||||||
|
- gosimple
|
||||||
- stylecheck
|
- stylecheck
|
||||||
- revive
|
- revive
|
||||||
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
|
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
|
||||||
disable-all: true
|
disable-all: true
|
||||||
linters-settings:
|
linters-settings:
|
||||||
staticcheck:
|
staticcheck:
|
||||||
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
|
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
|
||||||
checks: ["all"]
|
checks: ["all"]
|
||||||
|
stylecheck:
|
||||||
|
checks:
|
||||||
|
[
|
||||||
|
"all",
|
||||||
|
"-ST1000",
|
||||||
|
"-ST1001",
|
||||||
|
"-ST1003",
|
||||||
|
"-ST1016",
|
||||||
|
"-ST1020",
|
||||||
|
"-ST1021",
|
||||||
|
"-ST1022",
|
||||||
|
]
|
||||||
revive:
|
revive:
|
||||||
# Maximum number of open files at the same time.
|
# Maximum number of open files at the same time.
|
||||||
# See https://github.com/mgechev/revive#command-line-flags
|
# See https://github.com/mgechev/revive#command-line-flags
|
||||||
@@ -40,15 +52,6 @@ linters:
|
|||||||
# Default: 0.8
|
# Default: 0.8
|
||||||
confidence: 0.1
|
confidence: 0.1
|
||||||
rules:
|
rules:
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant
|
|
||||||
- name: add-constant
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
arguments:
|
|
||||||
- maxLitCount: "3"
|
|
||||||
allowStrs: '""'
|
|
||||||
allowInts: "0,1,2"
|
|
||||||
allowFloats: "0.0,0.,1.0,1.,2.0,2."
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#argument-limit
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#argument-limit
|
||||||
- name: argument-limit
|
- name: argument-limit
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -63,14 +66,6 @@ linters:
|
|||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
arguments: ["Ω", "Σ", "σ", "7"]
|
arguments: ["Ω", "Σ", "σ", "7"]
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bare-return
|
|
||||||
- name: bare-return
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports
|
|
||||||
- name: blank-imports
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
|
||||||
- name: bool-literal-in-expr
|
- name: bool-literal-in-expr
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -108,7 +103,7 @@ linters:
|
|||||||
- name: cyclomatic
|
- name: cyclomatic
|
||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
arguments: [3]
|
arguments: [5]
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace
|
||||||
- name: datarace
|
- name: datarace
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -123,10 +118,6 @@ linters:
|
|||||||
disabled: false
|
disabled: false
|
||||||
arguments:
|
arguments:
|
||||||
- ["call-chain", "loop"]
|
- ["call-chain", "loop"]
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports
|
|
||||||
- name: dot-imports
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports
|
||||||
- name: duplicated-imports
|
- name: duplicated-imports
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -135,14 +126,6 @@ linters:
|
|||||||
- name: early-return
|
- name: early-return
|
||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block
|
|
||||||
- name: empty-block
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
|
|
||||||
- name: empty-lines
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming
|
||||||
- name: error-naming
|
- name: error-naming
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -166,12 +149,6 @@ linters:
|
|||||||
arguments:
|
arguments:
|
||||||
- "checkPrivateReceivers"
|
- "checkPrivateReceivers"
|
||||||
- "sayRepetitiveInsteadOfStutters"
|
- "sayRepetitiveInsteadOfStutters"
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#file-header
|
|
||||||
- name: file-header
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
arguments:
|
|
||||||
- This is the text that must appear at the top of source files.
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter
|
||||||
- name: flag-parameter
|
- name: flag-parameter
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -185,7 +162,7 @@ linters:
|
|||||||
- name: function-length
|
- name: function-length
|
||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
arguments: [10, 0]
|
arguments: [100, 0]
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return
|
||||||
- name: get-return
|
- name: get-return
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -213,20 +190,6 @@ linters:
|
|||||||
arguments:
|
arguments:
|
||||||
- "crypto/md5"
|
- "crypto/md5"
|
||||||
- "crypto/sha1"
|
- "crypto/sha1"
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing
|
|
||||||
- name: import-shadowing
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#line-length-limit
|
|
||||||
- name: line-length-limit
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
arguments: [80]
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-public-structs
|
|
||||||
- name: max-public-structs
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
arguments: [3]
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter
|
||||||
- name: modifies-parameter
|
- name: modifies-parameter
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -276,10 +239,10 @@ linters:
|
|||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
arguments:
|
arguments:
|
||||||
- - 'core.WriteError[1].Message'
|
- - "core.WriteError[1].Message"
|
||||||
- '/^([^A-Z]|$)/'
|
- "/^([^A-Z]|$)/"
|
||||||
- must not start with a capital letter
|
- must not start with a capital letter
|
||||||
- - 'fmt.Errorf[0]'
|
- - "fmt.Errorf[0]"
|
||||||
- '/(^|[^\.!?])$/'
|
- '/(^|[^\.!?])$/'
|
||||||
- must not end in punctuation
|
- must not end in punctuation
|
||||||
- - panic
|
- - panic
|
||||||
@@ -329,7 +292,8 @@ linters:
|
|||||||
disabled: false
|
disabled: false
|
||||||
arguments:
|
arguments:
|
||||||
- "fmt.Printf"
|
- "fmt.Printf"
|
||||||
- "myFunction"
|
- "os.(Create|WriteFile|Chmod)"
|
||||||
|
- "net.*"
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt
|
||||||
- name: unnecessary-stmt
|
- name: unnecessary-stmt
|
||||||
severity: warning
|
severity: warning
|
||||||
@@ -338,14 +302,6 @@ linters:
|
|||||||
- name: unreachable-code
|
- name: unreachable-code
|
||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
|
|
||||||
- name: unused-parameter
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
|
|
||||||
- name: unused-receiver
|
|
||||||
severity: warning
|
|
||||||
disabled: false
|
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
|
||||||
- name: useless-break
|
- name: useless-break
|
||||||
severity: warning
|
severity: warning
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ alias gitb="git branch --show-current | tr -d '\n' | pbcopy"
|
|||||||
alias gci="golangci-lint run -c=~/.dotfile/.golangci.yml ./..."
|
alias gci="golangci-lint run -c=~/.dotfile/.golangci.yml ./..."
|
||||||
alias gmt="go mod tidy"
|
alias gmt="go mod tidy"
|
||||||
alias gtc="go test -gcflags=all=-l -cover ./..."
|
alias gtc="go test -gcflags=all=-l -cover ./..."
|
||||||
alias gtr="(){go test -gcflags=all=-l -v -run $1. ;}"
|
|
||||||
alias swg="swag init -o docs -g "
|
alias swg="swag init -o docs -g "
|
||||||
alias sws="swagger serve -F=swagger"
|
alias sws="swagger serve -F=swagger"
|
||||||
|
|
||||||
|
function gtr(){
|
||||||
|
go test -gcflags=all=-l -v -run="$1"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user