aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2022-08-17 16:19:45 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-22 09:30:19 +0200
commit9cffc45f0347e5c8b801c151955fa9326b9b2ba7 (patch)
tree4de8e74f1ec7378297185f65807cb9019caf1a1a /worker
parent1b91b68e7385239783bee818974c4ce2032b7039 (diff)
downloadaerc-9cffc45f0347e5c8b801c151955fa9326b9b2ba7.tar.gz
go: removed io/ioutil
Since the minimum required version of Go has been bumped to 1.16, the deprecation of io/ioutil can now be acted upon. This Commit removes the remaining dependencies on ioutil and replaces them with their io or os counterparts. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker')
-rw-r--r--worker/lib/parse_test.go5
-rw-r--r--worker/lib/search.go6
-rw-r--r--worker/maildir/search.go6
-rw-r--r--worker/maildir/worker.go3
-rw-r--r--worker/mbox/io.go3
-rw-r--r--worker/mbox/models.go5
-rw-r--r--worker/mbox/worker.go4
-rw-r--r--worker/notmuch/worker.go4
8 files changed, 16 insertions, 20 deletions
diff --git a/worker/lib/parse_test.go b/worker/lib/parse_test.go
index 7e5bb367..227b121e 100644
--- a/worker/lib/parse_test.go
+++ b/worker/lib/parse_test.go
@@ -2,7 +2,6 @@ package lib
import (
"io"
- "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -12,7 +11,7 @@ import (
func TestMessageInfoParser(t *testing.T) {
rootDir := "testdata/message/valid"
- msgFiles, err := ioutil.ReadDir(rootDir)
+ msgFiles, err := os.ReadDir(rootDir)
die(err)
for _, fi := range msgFiles {
@@ -37,7 +36,7 @@ func TestMessageInfoParser(t *testing.T) {
func TestMessageInfoHandledError(t *testing.T) {
rootDir := "testdata/message/invalid"
- msgFiles, err := ioutil.ReadDir(rootDir)
+ msgFiles, err := os.ReadDir(rootDir)
die(err)
for _, fi := range msgFiles {
diff --git a/worker/lib/search.go b/worker/lib/search.go
index 551d33cd..fe1ec114 100644
--- a/worker/lib/search.go
+++ b/worker/lib/search.go
@@ -1,7 +1,7 @@
package lib
import (
- "io/ioutil"
+ "io"
"net/textproto"
"strings"
"unicode"
@@ -129,7 +129,7 @@ func searchMessage(message RawMessage, criteria *searchCriteria,
return false, err
}
defer reader.Close()
- bytes, err := ioutil.ReadAll(reader)
+ bytes, err := io.ReadAll(reader)
if err != nil {
return false, err
}
@@ -141,7 +141,7 @@ func searchMessage(message RawMessage, criteria *searchCriteria,
return false, err
}
defer reader.Close()
- bytes, err := ioutil.ReadAll(reader)
+ bytes, err := io.ReadAll(reader)
if err != nil {
return false, err
}
diff --git a/worker/maildir/search.go b/worker/maildir/search.go
index 6260deb4..2ad1c0e1 100644
--- a/worker/maildir/search.go
+++ b/worker/maildir/search.go
@@ -1,7 +1,7 @@
package maildir
import (
- "io/ioutil"
+ "io"
"net/textproto"
"strings"
"unicode"
@@ -151,7 +151,7 @@ func (w *Worker) searchKey(key uint32, criteria *searchCriteria,
if err != nil {
return false, err
}
- bytes, err := ioutil.ReadAll(reader)
+ bytes, err := io.ReadAll(reader)
if err != nil {
return false, err
}
@@ -163,7 +163,7 @@ func (w *Worker) searchKey(key uint32, criteria *searchCriteria,
return false, err
}
defer reader.Close()
- bytes, err := ioutil.ReadAll(reader)
+ bytes, err := io.ReadAll(reader)
if err != nil {
return false, err
}
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 9f9fee9a..e482f4e0 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"net/url"
"os"
"os/exec"
@@ -543,7 +542,7 @@ func (w *Worker) handleFetchFullMessages(msg *types.FetchFullMessages) error {
return err
}
defer r.Close()
- b, err := ioutil.ReadAll(r)
+ b, err := io.ReadAll(r)
if err != nil {
return err
}
diff --git a/worker/mbox/io.go b/worker/mbox/io.go
index 67290482..31a906cc 100644
--- a/worker/mbox/io.go
+++ b/worker/mbox/io.go
@@ -3,7 +3,6 @@ package mboxer
import (
"errors"
"io"
- "io/ioutil"
"time"
"git.sr.ht/~rjarry/aerc/models"
@@ -23,7 +22,7 @@ func Read(r io.Reader) ([]lib.RawMessage, error) {
return nil, err
}
- content, err := ioutil.ReadAll(msg)
+ content, err := io.ReadAll(msg)
if err != nil {
return nil, err
}
diff --git a/worker/mbox/models.go b/worker/mbox/models.go
index 849133c1..eec73379 100644
--- a/worker/mbox/models.go
+++ b/worker/mbox/models.go
@@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/lib"
@@ -150,7 +149,7 @@ func (f *container) newUid() (next uint32) {
}
func (f *container) Append(r io.Reader, flags []models.Flag) error {
- data, err := ioutil.ReadAll(r)
+ data, err := io.ReadAll(r)
if err != nil {
return err
}
@@ -170,7 +169,7 @@ type message struct {
}
func (m *message) NewReader() (io.ReadCloser, error) {
- return ioutil.NopCloser(bytes.NewReader(m.content)), nil
+ return io.NopCloser(bytes.NewReader(m.content)), nil
}
func (m *message) ModelFlags() ([]models.Flag, error) {
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go
index 1e3ab982..78a9b1b6 100644
--- a/worker/mbox/worker.go
+++ b/worker/mbox/worker.go
@@ -4,7 +4,7 @@ import (
"bytes"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"net/url"
"os"
"path/filepath"
@@ -224,7 +224,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
continue
}
defer r.Close()
- b, err := ioutil.ReadAll(r)
+ b, err := io.ReadAll(r)
if err != nil {
logging.Errorf("could not get message reader: %w", err)
continue
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index e6a9a492..903460eb 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -9,7 +9,7 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"net/url"
"os"
"os/exec"
@@ -396,7 +396,7 @@ func (w *worker) handleFetchFullMessages(msg *types.FetchFullMessages) error {
return err
}
defer r.Close()
- b, err := ioutil.ReadAll(r)
+ b, err := io.ReadAll(r)
if err != nil {
return err
}