[golangci-lint]: Use constant for result.

This commit is contained in:
Martin Dosch 2023-06-04 15:57:23 +02:00
parent d85cf8fee7
commit a0b6c045c7
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D
3 changed files with 7 additions and 6 deletions

View File

@ -23,4 +23,5 @@ const (
strChat = "chat" strChat = "chat"
strError = "error" strError = "error"
strGroupchat = "groupchat" strGroupchat = "groupchat"
strResult = "result"
) )

View File

@ -85,7 +85,7 @@ func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ,
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
if iqDiscoInfo.Type != "result" { if iqDiscoInfo.Type != strResult {
continue continue
} }
iqDiscoInfoXML := etree.NewDocument() iqDiscoInfoXML := etree.NewDocument()
@ -170,7 +170,7 @@ func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ,
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
if uploadSlot.Type != "result" { if uploadSlot.Type != strResult {
log.Fatal("error while requesting upload slot.") log.Fatal("error while requesting upload slot.")
} }
iqHTTPUploadSlotXML := etree.NewDocument() iqHTTPUploadSlotXML := etree.NewDocument()

8
ox.go
View File

@ -265,7 +265,7 @@ func oxPublishPubKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
if err != nil { if err != nil {
return err return err
} }
if iqReply.Type != "result" { if iqReply.Type != strResult {
return errors.New("error while publishing public key") return errors.New("error while publishing public key")
} }
ownPubKeyRingFromPubsub, err := oxRecvPublicKeys(client, iqc, jid, fingerprint) ownPubKeyRingFromPubsub, err := oxRecvPublicKeys(client, iqc, jid, fingerprint)
@ -313,7 +313,7 @@ func oxPublishPubKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
if err != nil { if err != nil {
return err return err
} }
if iqReply.Type != "result" { if iqReply.Type != strResult {
return errors.New("couldn't publish public key list") return errors.New("couldn't publish public key list")
} }
return nil return nil
@ -499,7 +499,7 @@ func oxRecvPublicKeys(client *xmpp.Client, iqc chan xmpp.IQ, recipient string,
if err != nil { if err != nil {
return nil, err return nil, err
} }
if oxPublicKey.Type != "result" { if oxPublicKey.Type != strResult {
return nil, errors.New("error while requesting public key for " + return nil, errors.New("error while requesting public key for " +
recipient) recipient)
} }
@ -574,7 +574,7 @@ func oxGetPublicKeyRing(client *xmpp.Client, iqc chan xmpp.IQ,
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
if oxPublicKeyList.Type != "result" { if oxPublicKeyList.Type != strResult {
return nil, errors.New("error while requesting public openpgp keys for " + return nil, errors.New("error while requesting public openpgp keys for " +
recipient) recipient)
} }