From 2ee1c582839a4d3c435eb4c2f2c719806cf5d435 Mon Sep 17 00:00:00 2001 From: Jake Urban Date: Tue, 24 Jan 2023 13:55:07 -0800 Subject: [PATCH] minor adjustments for go check --- exp/services/webauth/internal/serve/token.go | 4 ++-- txnbuild/transaction.go | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/exp/services/webauth/internal/serve/token.go b/exp/services/webauth/internal/serve/token.go index ba9df83bef..22796d21c6 100644 --- a/exp/services/webauth/internal/serve/token.go +++ b/exp/services/webauth/internal/serve/token.go @@ -88,8 +88,8 @@ func (h tokenHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { l.Info("Start verifying challenge transaction.") - var muxedAccount xdr.MuxedAccount - if muxedAccount, err = xdr.AddressToMuxedAccount(clientAccountID); err == nil { + muxedAccount, err := xdr.AddressToMuxedAccount(clientAccountID) + if err == nil { clientAccountID = muxedAccount.ToAccountId().Address() } diff --git a/txnbuild/transaction.go b/txnbuild/transaction.go index af23b48831..a43fa72ea2 100644 --- a/txnbuild/transaction.go +++ b/txnbuild/transaction.go @@ -1027,7 +1027,8 @@ func BuildChallengeTx(serverSignerSecret, clientAccountID, webAuthDomain, homeDo return nil, errors.New("memos are not valid for challenge transactions with a muxed client account") } } else if memo != nil { - if xdrMemo, err := memo.ToXDR(); err != nil || xdrMemo.Type != xdr.MemoTypeMemoId { + var xdrMemo xdr.Memo + if xdrMemo, err = memo.ToXDR(); err != nil || xdrMemo.Type != xdr.MemoTypeMemoId { return nil, errors.New("memo must be of type MemoID") } } @@ -1182,7 +1183,8 @@ func ReadChallengeTx(challengeTx, serverAccountID, network, webAuthDomain string err = errors.New("memos are not valid for challenge transactions with a muxed client account") return tx, clientAccountID, matchedHomeDomain, memo, err } else if rawOperations[0].SourceAccount.Type == xdr.CryptoKeyTypeKeyTypeEd25519 && memo != nil { - if rawMemo, err := memo.ToXDR(); err != nil || rawMemo.Type != xdr.MemoTypeMemoId { + var rawMemo xdr.Memo + if rawMemo, err = memo.ToXDR(); err != nil || rawMemo.Type != xdr.MemoTypeMemoId { err = errors.New("invalid memo, only ID memos are permitted") return tx, clientAccountID, matchedHomeDomain, memo, err }