Skip to content

Commit

Permalink
[mixed] fix ioutil deprecation
Browse files Browse the repository at this point in the history
Signed-off-by: Flipez <code@brauser.io>
  • Loading branch information
Flipez committed Oct 30, 2022
1 parent 1c590ae commit f50fc94
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

0 comments on commit f50fc94

Please sign in to comment.