From eea2118fc329c9ed7e3e157884286bc7fc91db01 Mon Sep 17 00:00:00 2001 From: web3-bot Date: Mon, 29 Aug 2022 14:27:28 +0000 Subject: [PATCH] stop using the deprecated io/ioutil package This commit was moved from ipfs/go-mfs@80d7a0f99971271980f5806fbe07829b3501ef17 --- mfs/mfs_test.go | 11 +++++------ mfs/repub.go | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mfs/mfs_test.go b/mfs/mfs_test.go index 1ea90ef33..ace1f7667 100644 --- a/mfs/mfs_test.go +++ b/mfs/mfs_test.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math/rand" "os" "sort" @@ -176,7 +175,7 @@ func assertFileAtPath(ds ipld.DAGService, root *Directory, expn ipld.Node, pth s return err } - out, err := ioutil.ReadAll(rfd) + out, err := io.ReadAll(rfd) if err != nil { return err } @@ -199,7 +198,7 @@ func catNode(ds ipld.DAGService, nd *dag.ProtoNode) ([]byte, error) { } defer r.Close() - return ioutil.ReadAll(r) + return io.ReadAll(r) } func setupRoot(ctx context.Context, t *testing.T) (ipld.DAGService, *Root) { @@ -831,7 +830,7 @@ func actorReadFile(d *Directory) error { return err } - _, err = ioutil.ReadAll(rfd) + _, err = io.ReadAll(rfd) if err != nil { return err } @@ -1116,7 +1115,7 @@ func writeFile(rt *Root, path string, transform func([]byte) []byte) error { } defer fd.Close() - data, err := ioutil.ReadAll(fd) + data, err := io.ReadAll(fd) if err != nil { return err } @@ -1383,7 +1382,7 @@ func TestTruncateAndWrite(t *testing.T) { t.Fatal(err) } - data, err := ioutil.ReadAll(fd) + data, err := io.ReadAll(fd) if err != nil { t.Fatal(err) } diff --git a/mfs/repub.go b/mfs/repub.go index 2c9dbd25d..463810414 100644 --- a/mfs/repub.go +++ b/mfs/repub.go @@ -87,10 +87,10 @@ func (rp *Republisher) Update(c cid.Cid) { // updates. // // Algorithm: -// 1. When we receive the first update after publishing, we set a `longer` timer. -// 2. When we receive any update, we reset the `quick` timer. -// 3. If either the `quick` timeout or the `longer` timeout elapses, -// we call `publish` with the latest updated value. +// 1. When we receive the first update after publishing, we set a `longer` timer. +// 2. When we receive any update, we reset the `quick` timer. +// 3. If either the `quick` timeout or the `longer` timeout elapses, +// we call `publish` with the latest updated value. // // The `longer` timer ensures that we delay publishing by at most // `TimeoutLong`. The `quick` timer allows us to publish sooner if