chore: io/ioutil has been deprecated

This commit is contained in:
Christian Schwarz
2024-09-08 13:15:26 +00:00
parent 48c5b60024
commit 740ab4b1b2
9 changed files with 11 additions and 20 deletions
@@ -5,7 +5,6 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"os"
"path"
@@ -47,7 +46,7 @@ func main() {
flag.StringVar(&args.testCase, "testcase", "", "")
flag.Parse()
bytes, err := ioutil.ReadFile(args.configPath)
bytes, err := os.ReadFile(args.configPath)
noerror(err)
err = yaml.UnmarshalStrict(bytes, &conf)
noerror(err)
@@ -3,7 +3,6 @@ package main
import (
"bytes"
"io"
"io/ioutil"
"log"
"github.com/zrepl/zrepl/transport"
@@ -83,7 +82,7 @@ func (CloseWrite) receiver(wire transport.Wire) {
// consume half the test data, then detect an error, send it and CloseWrite
r := io.LimitReader(wire, int64(5*len(closeWriteTestSendData)/3))
_, err := io.Copy(ioutil.Discard, r)
_, err := io.Copy(io.Discard, r)
noerror(err)
var errBuf bytes.Buffer
@@ -95,7 +94,7 @@ func (CloseWrite) receiver(wire transport.Wire) {
noerror(err)
// drain wire, as documented in transport.Wire, this is the only way we know the client closed the conn
_, err = io.Copy(ioutil.Discard, wire)
_, err = io.Copy(io.Discard, wire)
if err != nil {
// io.Copy masks io.EOF to nil, and we expect io.EOF from the client's Close() call
log.Panicf("unexpected error returned from reading conn: %s", err)