Skip to content

Commit

Permalink
Add errorlint linter (#226)
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Shishkin <me@teran.dev>
  • Loading branch information
teran committed Sep 3, 2024
1 parent dd0c06a commit 064b6c2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ linters:
- err113
- errcheck
- errchkjson
- errorlint
- errname
- goconst
- gocritic
Expand Down
2 changes: 1 addition & 1 deletion publisher/presenter/html/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (h *handlers) ErrorHandler(err error, c echo.Context) {
code := 500
templateFilename := serverErrorTemplateFilename

v, ok := err.(*echo.HTTPError)
v, ok := err.(*echo.HTTPError) // nolint:errorlint
if ok {
code = v.Code
if v.Code == http.StatusNotFound {
Expand Down
2 changes: 1 addition & 1 deletion repositories/metadata/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func mapSQLErrors(err error) error {
return metadata.ErrNotFound
}

if err, ok := err.(*pq.Error); ok {
if err, ok := err.(*pq.Error); ok { // nolint:errorlint
if err.Code == "23505" {
return metadata.ErrConflict
}
Expand Down
4 changes: 2 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ func (s *service) DeleteObject(ctx context.Context, namespace, container, versio
}

func mapMetadataErrors(err error) error {
switch err {
case metadata.ErrNotFound:
switch {
case errors.Is(err, metadata.ErrNotFound):
return ErrNotFound
default:
return err
Expand Down

0 comments on commit 064b6c2

Please sign in to comment.