~migadu/alps-devel

plugins/base/routes: fix err variable shadowing v1 APPLIED

Silvan Jegen: 1
 plugins/base/routes: fix err variable shadowing

 1 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~migadu/alps-devel/patches/56578/mbox | git am -3
Learn more about email & git

[PATCH] plugins/base/routes: fix err variable shadowing Export this patch

Redeclaring the same variable shadows the outer one. This means the
error check below will never check this error.

This issue was found with golangci-lint.

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
---
 plugins/base/routes.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 10b30c1..623a5cc 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -857,8 +857,8 @@ func populateMessageFromOriginalMessage(ctx *alps.Context, inReplyToPath message

		ret.Text, err = quote(strings.NewReader(text))
	default:
		err := fmt.Errorf("cannot forward %q part", mimeType)
		err = echo.NewHTTPError(http.StatusBadRequest, err)
		defErr := fmt.Errorf("cannot forward %q part", mimeType)
		err = echo.NewHTTPError(http.StatusBadRequest, defErr)
	}
	if err != nil {
		return ret, err
@@ -944,8 +944,8 @@ func handleForward(ctx *alps.Context) error {

			msg.Text, err = quote(strings.NewReader(text))
		default:
			err := fmt.Errorf("cannot forward %q part", mimeType)
			err = echo.NewHTTPError(http.StatusBadRequest, err)
			defErr := fmt.Errorf("cannot forward %q part", mimeType)
			err = echo.NewHTTPError(http.StatusBadRequest, defErr)
		}
		if err != nil {
			return err
-- 
2.47.1
Good catch! Pushed, thanks!