diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-12-14 01:36:26 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2022-01-24 15:24:39 +0300 |
commit | 933c033f153891f5e338b8463b3b8f3c91d8885e (patch) | |
tree | ef7c6e74878a87df4449de897aa1fe1c845a51af /internal/serving | |
parent | c27b7ef86e28c9e97c5c655a958bdb733aca01eb (diff) |
lint: fix errorlint issues
Diffstat (limited to 'internal/serving')
-rw-r--r-- | internal/serving/disk/reader.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go index 5961d843..4078d5ef 100644 --- a/internal/serving/disk/reader.go +++ b/internal/serving/disk/reader.go @@ -50,7 +50,7 @@ func (reader *Reader) tryRedirects(h serving.Handler) bool { rewrittenURL, status, err := r.Rewrite(h.Request.URL) if err != nil { - if err != redirects.ErrNoRedirect { + if !errors.Is(err, redirects.ErrNoRedirect) { // We assume that rewrite failure is not fatal // and we only capture the error errortracking.Capture(err, errortracking.WithRequest(h.Request), errortracking.WithStackTrace()) @@ -81,7 +81,8 @@ func (reader *Reader) tryFile(h serving.Handler) bool { request := h.Request urlPath := request.URL.Path - if locationError, _ := err.(*locationDirectoryError); locationError != nil { + var locationDirError *locationDirectoryError + if errors.As(err, &locationDirError) { if endsWithSlash(urlPath) { fullPath, err = reader.resolvePath(ctx, root, h.SubPath, "index.html") } else { @@ -90,7 +91,8 @@ func (reader *Reader) tryFile(h serving.Handler) bool { } } - if locationError, _ := err.(*locationFileNoExtensionError); locationError != nil { + var locationFileError *locationFileNoExtensionError + if errors.As(err, &locationFileError) { fullPath, err = reader.resolvePath(ctx, root, strings.TrimSuffix(h.SubPath, "/")+".html") } |