Skip to content

Commit

Permalink
Replace deprecated io/ioutil (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
harryzcy authored Feb 26, 2024
1 parent 31fe1ba commit 4653a1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions cmd/ycat/ycat.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"errors"
"fmt"
"io/ioutil"
"os"

"github.com/fatih/color"
Expand All @@ -24,7 +23,7 @@ func _main(args []string) error {
return errors.New("ycat: usage: ycat file.yml")
}
filename := args[1]
bytes, err := ioutil.ReadFile(filename)
bytes, err := os.ReadFile(filename)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"path/filepath"
Expand Down Expand Up @@ -1621,7 +1620,7 @@ func (d *Decoder) resolveReference() error {
}
}
for _, reader := range d.referenceReaders {
bytes, err := ioutil.ReadAll(reader)
bytes, err := io.ReadAll(reader)
if err != nil {
return errors.Wrapf(err, "failed to read buffer")
}
Expand Down
4 changes: 2 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package parser

import (
"fmt"
"io/ioutil"
"os"
"strings"

"github.com/goccy/go-yaml/ast"
Expand Down Expand Up @@ -730,7 +730,7 @@ func Parse(tokens token.Tokens, mode Mode) (*ast.File, error) {

// Parse parse from filename, and returns ast.File
func ParseFile(filename string, mode Mode) (*ast.File, error) {
file, err := ioutil.ReadFile(filename)
file, err := os.ReadFile(filename)
if err != nil {
return nil, errors.Wrapf(err, "failed to read file: %s", filename)
}
Expand Down

0 comments on commit 4653a1b

Please sign in to comment.