Skip to content

Commit

Permalink
Merge pull request #135 from Flipez/fix-ioutil-deprecation
Browse files Browse the repository at this point in the history
[mixed] fix ioutil deprecation
  • Loading branch information
Flipez authored Oct 30, 2022
2 parents 6c7cc33 + f50fc94 commit 58b7547
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

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

flag "github.com/spf13/pflag"
Expand Down Expand Up @@ -39,7 +38,7 @@ func main() {
if len(os.Args) == 1 {
repl.Start(os.Stdin, os.Stdout)
} else {
file, err := ioutil.ReadFile(os.Args[1])
file, err := os.ReadFile(os.Args[1])
if err == nil {
runProgram(string(file))
}
Expand Down
4 changes: 2 additions & 2 deletions object/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package object

import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -231,7 +231,7 @@ func readFile(o Object, _ []Object, _ Environment) Object {
return NewError(err)
}

file, err := ioutil.ReadAll(f.Handle)
file, err := io.ReadAll(f.Handle)
if err != nil {
return NewError(err)
}
Expand Down
4 changes: 2 additions & 2 deletions object/http_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package object_test

import (
"io/ioutil"
"io"
"log"
"net/http"
"strings"
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestHTTPServerMethods(t *testing.T) {
log.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
Expand Down

2 comments on commit 58b7547

@vercel
Copy link

@vercel vercel bot commented on 58b7547 Oct 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 58b7547 Oct 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.