fix: lint issues

This commit is contained in:
Kevin Franklin Kim 2024-11-11 10:08:14 +01:00
parent 16fa0b11ad
commit 0737add060
No known key found for this signature in database
3 changed files with 19 additions and 8 deletions

View File

@ -52,6 +52,19 @@ linters:
- unused # (megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
# Disabled by default linters:
#- canonicalheader # canonicalheader checks whether net/http.Header uses canonical header [fast: false, auto-fix: false]
#- dupword # checks for duplicate words in the source code [fast: true, auto-fix: false]
#- fatcontext # detects nested contexts in loops and function literals [fast: false, auto-fix: false]
#- iface # Detect the incorrect use of interfaces, helping developers avoid interface pollution. [fast: false, auto-fix: false]
#- interfacebloat # A linter that checks the number of methods inside an interface. [fast: true, auto-fix: false]
#- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative. [fast: false, auto-fix: false]
#- reassign # Checks that package variables are not reassigned [fast: false, auto-fix: false]
#- recvcheck # checks for receiver type consistency [fast: false, auto-fix: false]
#- sloglint # ensure consistent code style when using log/slog [fast: false, auto-fix: false]
#- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true]
#- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]
- asasalint # check for pass []any as any in variadic func(...any) [fast: false, auto-fix: false]
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false]
- bidichk # Checks for dangerous unicode character sequences [fast: true, auto-fix: false]
@ -67,10 +80,8 @@ linters:
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted. [fast: false, auto-fix: false]
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false]
- 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]
- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds [fast: false, auto-fix: false]
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
#- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
- exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false]
#- forbidigo # Forbids identifiers [fast: true, auto-fix: false]
- forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
#- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
@ -83,12 +94,12 @@ linters:
#- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
#- godot # Check if comments end in a period [fast: true, auto-fix: true]
#- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
#- goerr113 # Golang linter to check the errors handling expressions [fast: false, auto-fix: false]
#- err113: Go linter to check the errors handling expressions [fast: false, auto-fix: false]
- 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]
#- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
- goheader # Checks is file header matches to pattern [fast: true, auto-fix: false]
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. [fast: true, auto-fix: true]
#- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
#- mnd: An analyzer to detect magic numbers. [fast: true, auto-fix: false]
#- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
- 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]
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]

View File

@ -21,8 +21,8 @@ type (
)
const (
ScalarErrorOne ScalarError = "scalar error one" //nolint:errname
ScalarErrorTwo ScalarError = "scalar error two" //nolint:errname
ScalarErrorOne ScalarError = "scalar error one"
ScalarErrorTwo ScalarError = "scalar error two"
)
func NewScalarError(e ScalarError) *ScalarError {

View File

@ -39,8 +39,8 @@ type (
)
const (
ScalarOne ScalarError = "one" //nolint:errname
ScalarTwo ScalarError = "two" //nolint:errname
ScalarOne ScalarError = "one"
ScalarTwo ScalarError = "two"
ScalarAOne ScalarA = "one"
ScalarATwo ScalarA = "two"