Other: Update golangci-lint to v1.50.0

This commit is contained in:
Leander Beernaert
2022-10-17 11:02:56 +02:00
parent e0603f741f
commit 9d800324af
70 changed files with 247 additions and 277 deletions

View File

@ -20,7 +20,6 @@ package message
import (
"context"
"io"
"io/ioutil"
"sync"
"github.com/ProtonMail/gopenpgp/v2/crypto"
@ -52,8 +51,8 @@ type Fetcher interface {
}
// NewBuilder creates a new builder which manages the given number of fetch/attach/build workers.
// - fetchWorkers: the number of workers which fetch messages from API
// - attachWorkers: the number of workers which fetch attachments from API.
// - fetchWorkers: the number of workers which fetch messages from API
// - attachWorkers: the number of workers which fetch attachments from API.
//
// The returned builder is ready to handle jobs -- see (*Builder).NewJob for more information.
//
@ -167,7 +166,7 @@ func newAttacherWorkFunc() pool.WorkFunc {
return nil, err
}
b, err := ioutil.ReadAll(rc)
b, err := io.ReadAll(rc)
if err != nil {
return nil, err
}
@ -209,7 +208,7 @@ func newFetcherWorkFunc(attachmentPool *pool.Pool) pool.WorkFunc {
return nil, err
}
b, err := ioutil.ReadAll(rc)
b, err := io.ReadAll(rc)
if err != nil {
_ = rc.Close()
return nil, err

View File

@ -21,7 +21,6 @@ import (
"bytes"
"encoding/base64"
"io"
"io/ioutil"
"mime"
"mime/multipart"
"net/http"
@ -83,7 +82,7 @@ func BuildEncrypted(m *pmapi.Message, readers []io.Reader, kr *crypto.KeyRing) (
return nil, err
}
data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
return nil, err
}

View File

@ -21,7 +21,6 @@ import (
"bytes"
"encoding/base64"
"io"
"io/ioutil"
"mime"
"mime/quotedprintable"
"strings"
@ -33,7 +32,7 @@ import (
)
func EncryptRFC822(kr *crypto.KeyRing, r io.Reader) ([]byte, error) {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, err
}
@ -118,7 +117,7 @@ func writeEncryptedPart(kr *crypto.KeyRing, header *textproto.Header, r io.Reade
}
func writeEncryptedTextPart(w io.Writer, r io.Reader, kr *crypto.KeyRing) error {
dec, err := ioutil.ReadAll(r)
dec, err := io.ReadAll(r)
if err != nil {
return err
}
@ -146,7 +145,7 @@ func writeEncryptedTextPart(w io.Writer, r io.Reader, kr *crypto.KeyRing) error
}
func writeEncryptedAttachmentPart(w io.Writer, r io.Reader, kr *crypto.KeyRing) error {
dec, err := ioutil.ReadAll(r)
dec, err := io.ReadAll(r)
if err != nil {
return err
}

View File

@ -19,7 +19,7 @@ package message
import (
"bytes"
"io/ioutil"
"os"
"testing"
"github.com/ProtonMail/gopenpgp/v2/crypto"
@ -27,7 +27,7 @@ import (
)
func TestEncryptRFC822(t *testing.T) {
literal, err := ioutil.ReadFile("testdata/text_plain_latin1.eml")
literal, err := os.ReadFile("testdata/text_plain_latin1.eml")
require.NoError(t, err)
key, err := crypto.GenerateKey("name", "email", "rsa", 2048)
@ -46,7 +46,7 @@ func TestEncryptRFC822(t *testing.T) {
}
func TestEncryptRFC822Multipart(t *testing.T) {
literal, err := ioutil.ReadFile("testdata/multipart_alternative_nested.eml")
literal, err := os.ReadFile("testdata/multipart_alternative_nested.eml")
require.NoError(t, err)
key, err := crypto.GenerateKey("name", "email", "rsa", 2048)

View File

@ -21,7 +21,6 @@ import (
"bufio"
"bytes"
"io"
"io/ioutil"
"unicode"
"github.com/emersion/go-message/textproto"
@ -141,7 +140,7 @@ func splitHeaderBody(b []byte) ([]byte, []byte, error) {
}
}
body, err := ioutil.ReadAll(br)
body, err := io.ReadAll(br)
if err != nil && !errors.Is(err, io.EOF) {
return nil, nil, err
}

View File

@ -215,8 +215,8 @@ func collectAttachments(p *parser.Parser) ([]*pmapi.Attachment, []io.Reader, err
}
// buildBodies collects all text/html and text/plain parts and returns two bodies,
// - a rich text body (in which html is allowed), and
// - a plaintext body (in which html is converted to plaintext).
// - a rich text body (in which html is allowed), and
// - a plaintext body (in which html is converted to plaintext).
//
// text/html parts are converted to plaintext in order to build the plaintext body,
// unless there is already a plaintext part provided via multipart/alternative,

View File

@ -19,7 +19,6 @@ package parser
import (
"io"
"io/ioutil"
"github.com/emersion/go-message"
"github.com/sirupsen/logrus"
@ -129,7 +128,7 @@ func (p *Parser) parseEntity(e *message.Entity) error {
}
func (p *Parser) parsePart(e *message.Entity) (err error) {
bytes, err := ioutil.ReadAll(e.Body)
bytes, err := io.ReadAll(e.Body)
if err != nil {
return
}

View File

@ -19,7 +19,6 @@ package parser
import (
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
@ -44,7 +43,7 @@ func getFileReader(filename string) io.ReadCloser {
}
func getFileAsString(filename string) string {
b, err := ioutil.ReadAll(getFileReader(filename))
b, err := io.ReadAll(getFileReader(filename))
if err != nil {
panic(err)
}

View File

@ -20,7 +20,6 @@ package message
import (
"image/png"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
@ -603,7 +602,7 @@ func getFileReader(filename string) io.Reader {
}
func readerToString(r io.Reader) string {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
panic(err)
}

View File

@ -21,7 +21,6 @@ import (
"bufio"
"bytes"
"io"
"io/ioutil"
"net/textproto"
"strconv"
"strings"
@ -166,7 +165,7 @@ func (bs *BodyStructure) parseAllChildSections(r io.Reader, currentPath []int, s
}
} else {
// Count length.
_, _ = bodyReader.WriteTo(ioutil.Discard)
_, _ = bodyReader.WriteTo(io.Discard)
}
// Clear all buffers.

View File

@ -20,7 +20,7 @@ package message
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"sort"
@ -93,7 +93,7 @@ func TestParseBodyStructurePGP(t *testing.T) {
"2": "application/pgp-signature; name=\"OpenPGP_signature.asc\"",
}
b, err := ioutil.ReadFile("testdata/enc-body-structure.eml")
b, err := os.ReadFile("testdata/enc-body-structure.eml")
require.NoError(t, err)
bs, err := NewBodyStructure(bytes.NewReader(b))