From b426961d84cb34d02274e9c6496ffdac862cef04 Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Tue, 23 May 2023 13:29:11 -0600 Subject: [PATCH] Fix linter errors --- federationapi/routing/invite.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/federationapi/routing/invite.go b/federationapi/routing/invite.go index 5872fec4b..b004f5c14 100644 --- a/federationapi/routing/invite.go +++ b/federationapi/routing/invite.go @@ -61,17 +61,17 @@ func InviteV2( } } - invitedUser, err := spec.NewUserID(*inviteReq.Event().StateKey(), true) - if err != nil { + invitedUser, userErr := spec.NewUserID(*inviteReq.Event().StateKey(), true) + if userErr != nil { return util.JSONResponse{ Code: http.StatusBadRequest, - JSON: spec.InvalidParam(fmt.Sprintf("The user ID is invalid")), + JSON: spec.InvalidParam("The user ID is invalid"), } } if !cfg.Matrix.IsLocalServerName(invitedUser.Domain()) { return util.JSONResponse{ Code: http.StatusBadRequest, - JSON: spec.InvalidParam(fmt.Sprintf("The invited user domain does not belong to this server")), + JSON: spec.InvalidParam("The invited user domain does not belong to this server"), } } @@ -134,7 +134,7 @@ func InviteV1( } } var strippedState []gomatrixserverlib.InviteStrippedState - if err := json.Unmarshal(event.Unsigned(), &strippedState); err != nil { + if jsonErr := json.Unmarshal(event.Unsigned(), &strippedState); jsonErr != nil { // just warn, they may not have added any. util.GetLogger(httpReq.Context()).Warnf("failed to extract stripped state from invite event") } @@ -150,13 +150,13 @@ func InviteV1( if err != nil { return util.JSONResponse{ Code: http.StatusBadRequest, - JSON: spec.InvalidParam(fmt.Sprintf("The user ID is invalid")), + JSON: spec.InvalidParam("The user ID is invalid"), } } if !cfg.Matrix.IsLocalServerName(invitedUser.Domain()) { return util.JSONResponse{ Code: http.StatusBadRequest, - JSON: spec.InvalidParam(fmt.Sprintf("The invited user domain does not belong to this server")), + JSON: spec.InvalidParam("The invited user domain does not belong to this server"), } }