Skip to content

Commit

Permalink
Merge pull request #730 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
twmb authored May 26, 2024
2 parents 49e70fb + 3f253df commit eed3183
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -397,13 +396,13 @@ func (l *LineWriter) Write(line string, args ...any) {
func main() {
const dir = "definitions"
const enums = "enums"
dirents, err := ioutil.ReadDir(dir)
dirents, err := os.ReadDir(dir)
if err != nil {
die("unable to read definitions dir %s: %v", dir, err)
}

{ // first parse all enums for use in definitions
f, err := ioutil.ReadFile(filepath.Join(dir, enums))
f, err := os.ReadFile(filepath.Join(dir, enums))
if err != nil {
die("unable to read %s/%s: %v", dir, enums, err)
}
Expand All @@ -414,7 +413,7 @@ func main() {
if ent.Name() == enums || strings.HasPrefix(ent.Name(), ".") {
continue
}
f, err := ioutil.ReadFile(filepath.Join(dir, ent.Name()))
f, err := os.ReadFile(filepath.Join(dir, ent.Name()))
if err != nil {
die("unable to read %s/%s: %v", dir, ent.Name(), err)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/kgo/record_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -1829,7 +1828,7 @@ func (r *RecordReader) readExact(d []byte) error {
func (r *RecordReader) readDelim(d []byte) error {
// Empty delimiters opt in to reading the rest of the text.
if len(d) == 0 {
b, err := ioutil.ReadAll(r.r)
b, err := io.ReadAll(r.r)
r.buf = b
// ReadAll stops at io.EOF, but we need to bubble that up.
if err == nil {
Expand Down

0 comments on commit eed3183

Please sign in to comment.