Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove io/ioutil #792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions e2e/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"path/filepath"
Expand Down Expand Up @@ -337,7 +336,7 @@ func execFiles(ctx context.Context, engine *ferret.Instance, opts []runtime.Opti
if info.IsDir() {
log.Debug().Msg("path points to a directory. retrieving list of files...")

fileInfos, err := ioutil.ReadDir(path)
fileInfos, err := os.ReadDir(path)

if err != nil {
log.Debug().Err(err).Msg("failed to retrieve list of files")
Expand Down Expand Up @@ -373,7 +372,7 @@ func execFiles(ctx context.Context, engine *ferret.Instance, opts []runtime.Opti

log.Debug().Msg("path points to a file. starting to read content")

out, err := ioutil.ReadFile(path)
out, err := os.ReadFile(path)

if err != nil {
log.Debug().Err(err).Msg("failed to read content")
Expand Down
4 changes: 2 additions & 2 deletions pkg/stdlib/io/fs/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package fs

import (
"context"
"io/ioutil"
"os"

"github.com/MontFerret/ferret/pkg/runtime/core"
"github.com/MontFerret/ferret/pkg/runtime/values"
Expand All @@ -27,7 +27,7 @@ func Read(_ context.Context, args ...core.Value) (core.Value, error) {

path := args[0].String()

data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)

if err != nil {
return values.None, core.Error(err, "read file")
Expand Down
3 changes: 1 addition & 2 deletions pkg/stdlib/io/fs/util_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package fs_test

import (
"io/ioutil"
"os"

. "github.com/smartystreets/goconvey/convey"
)

func tempFile() (*os.File, func()) {
file, err := ioutil.TempFile("", "fstest")
file, err := os.CreateTemp("", "fstest")
So(err, ShouldBeNil)

fn := func() {
Expand Down
Loading