Skip to content

Commit 423a032

Browse files
committed
fixed deprecation notices
1 parent a6a82ae commit 423a032

File tree

8 files changed

+17
-16
lines changed

8 files changed

+17
-16
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ WORKDIR /abs
88
RUN go install github.com/jteeuwen/go-bindata/...
99
RUN go mod vendor
1010

11-
CMD bash
11+
CMD ["bash"]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ fmt:
66
build:
77
docker build -t abs .
88
bench:
9-
CONTEXT=abs go test `go list ./... | grep -v "/js"` -bench=.
9+
CONTEXT=abs go test `go list -buildvcs=false ./... | grep -v "/js"` -bench=.
1010
test_all: bench test
1111
test:
1212
# we don't want to test the JS package
13-
CONTEXT=abs go test `go list ./... | grep -v "/js"`
13+
CONTEXT=abs go test `go list -buildvcs=false ./... | grep -v "/js"`
1414
test_verbose:
1515
# this will show successful error [line:col] tests per #38
16-
CONTEXT=abs go test `go list ./... | grep -v "/js"` -v
16+
CONTEXT=abs go test `go list -buildvcs=false ./... | grep -v "/js"` -v
1717
repl:
1818
go run main.go
1919
build_simple:

evaluator/functions.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"encoding/csv"
77
"encoding/json"
88
"fmt"
9-
"io/ioutil"
109
"math"
1110
"math/big"
1211
mrand "math/rand"
@@ -2153,7 +2152,7 @@ var packageAliasesLoaded bool
21532152

21542153
func requireFn(tok token.Token, env *object.Environment, args ...object.Object) object.Object {
21552154
if !packageAliasesLoaded {
2156-
a, err := ioutil.ReadFile("./packages.abs.json")
2155+
a, err := os.ReadFile("./packages.abs.json")
21572156

21582157
// We couldn't open the packages, file, possibly doesn't exists
21592158
// and the code shouldn't fail
@@ -2225,7 +2224,7 @@ func doSource(tok token.Token, env *object.Environment, fileName string, args ..
22252224
code, error = Asset("stdlib/" + fileName[1:])
22262225
} else {
22272226
// load the source file
2228-
code, error = ioutil.ReadFile(fileName)
2227+
code, error = os.ReadFile(fileName)
22292228
}
22302229

22312230
if error != nil {

install/install.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"net/http"
109
"os"
1110
"path/filepath"
@@ -200,7 +199,12 @@ func createAlias(module string) (string, error) {
200199
}
201200
defer f.Close()
202201

203-
b, err := ioutil.ReadAll(f)
202+
b, err := io.ReadAll(f)
203+
204+
if err != nil {
205+
fmt.Printf("Could not read alias file %s\n", err)
206+
return "", err
207+
}
204208

205209
data := make(map[string]string)
206210
moduleName := filepath.Base(module)

repl/repl.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package repl
33
import (
44
"bytes"
55
"fmt"
6-
"io/ioutil"
76
"log"
87
"os"
98
"path/filepath"
@@ -34,7 +33,7 @@ func getAbsInitFile(env *object.Environment) {
3433
}
3534
initFile = filePath
3635
// read and eval the abs init file
37-
code, err := ioutil.ReadFile(initFile)
36+
code, err := os.ReadFile(initFile)
3837
if err != nil {
3938
// abs init file is optional -- nothing to do here
4039
return
@@ -137,7 +136,7 @@ func BeginRepl(args []string, version string) {
137136

138137
// this is a script
139138
// let's parse our argument as a file and run it
140-
code, err := ioutil.ReadFile(args[1])
139+
code, err := os.ReadFile(args[1])
141140
if err != nil {
142141
fmt.Fprintln(env.Stdio.Stdout, err.Error())
143142
os.Exit(99)

terminal/history.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func getHistory(historyFile string, maxLines int) []string {
7272
}
7373
fd.Close()
7474
// read the file and split the lines into history[...]
75-
bytes, err := ioutil.ReadFile(historyFile)
75+
bytes, err := os.ReadFile(historyFile)
7676
if err != nil {
7777
return history
7878
}

terminal/terminal.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
// autocompleter
2323
// navigate commands up
2424
// maybe only save incrementally in history https://stackoverflow.com/questions/7151261/append-to-a-file-in-go
25-
// remove deprecated ioutil methods
2625
// remove dependencies
2726
// worth renaming repl to runner? and maybe terminal back to repl
2827
// add prompt formatting tests

util/check_update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package util
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"net/http"
66
"strings"
77
)
@@ -16,7 +16,7 @@ func UpdateAvailable(version string) (string, bool) {
1616
}
1717
defer resp.Body.Close()
1818

19-
body, err := ioutil.ReadAll(resp.Body)
19+
body, err := io.ReadAll(resp.Body)
2020
if err != nil {
2121
return version, false
2222
}

0 commit comments

Comments
 (0)