Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Nov 11, 2024
1 parent 16fa0b1 commit 0737add
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
19 changes: 15 additions & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions example/errors/handler/backend/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions example/errors/service/backend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0737add

Please sign in to comment.