Skip to content

Commit

Permalink
Need to support Go 1.13
Browse files Browse the repository at this point in the history
Teverts some stuff from 183c821; forgot that we need to support Go 1.13
up, and the deprecated stuff wasn't deprecated until Go 1.16
  • Loading branch information
arp242 committed Oct 26, 2022
1 parent f476207 commit 7801cfb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package toml_test
import (
"bytes"
"io/fs"
"os"
"io/ioutil"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -114,7 +114,7 @@ func BenchmarkEncode(b *testing.B) {
}

func BenchmarkExample(b *testing.B) {
d, err := os.ReadFile("_example/example.toml")
d, err := ioutil.ReadFile("_example/example.toml")
if err != nil {
b.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"reflect"
Expand Down Expand Up @@ -147,7 +148,7 @@ func (dec *Decoder) Decode(v interface{}) (MetaData, error) {

// TODO: parser should read from io.Reader? Or at the very least, make it
// read from []byte rather than string
data, err := io.ReadAll(dec.r)
data, err := ioutil.ReadAll(dec.r)
if err != nil {
return MetaData{}, err
}
Expand Down
3 changes: 2 additions & 1 deletion decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"math"
"os"
"reflect"
Expand All @@ -30,7 +31,7 @@ func TestDecodeReader(t *testing.T) {
}

func TestDecodeFile(t *testing.T) {
tmp, err := os.CreateTemp("", "toml-")
tmp, err := ioutil.TempFile("", "toml-")
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,13 @@ func (p *parser) valueArray(it item) (interface{}, tomlType) {
val, typ := p.value(it, true)
array = append(array, val)
types = append(types, typ)
_ = types

// XXX: types isn't used here, we need it to record the accurate type
// information.
//
// Not entirely sure how to best store this; could use "key[0]",
// "key[1]" notation, or maybe store it on the Array type?
_ = types
}
return array, tomlArray
}
Expand Down

0 comments on commit 7801cfb

Please sign in to comment.