Skip to content

Commit

Permalink
Test fewer Go versions, and a few simple staticcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Oct 26, 2022
1 parent 68ce1fc commit 183c821
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
27 changes: 11 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,27 @@
"test": {
"strategy": {
"matrix": {

This comment has been minimized.

Copy link
@DeclanC1717

DeclanC1717 Dec 5, 2022

Dont work

This comment has been minimized.

Copy link
@arp242

arp242 Dec 5, 2022

Author Collaborator

Hm, what?

"go-version": ["1.13.x", "1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x", "1.19.x"],
"go-version": ["1.13.x", "1.19.x"],
"os": ["ubuntu-latest", "macos-latest", "windows-latest"]
}
},
"runs-on": "${{ matrix.os }}",
"env": {"GOPROXY": "direct"},
"steps": [
{
"steps": [{
"name": "Install Go",
"uses": "actions/setup-go@v2",
"uses": "actions/setup-go@v3",
"with": {"go-version": "${{ matrix.go-version }}"}
},
{
}, {
"name": "Checkout code",
"uses": "actions/checkout@v2"
},
{
"uses": "actions/checkout@v3"
}, {
"name": "Test",
"run": "go test -v ./..."
},
{
"run": "go test ./..."
}, {
"name": "Test on 32bit",
"if": "runner.os == 'Linux'",
"run": "GOARCH=386 go test -v ./..."
}
]
"if": "runner.os == 'Linux'",
"run": "GOARCH=386 go test ./..."
}]
}
}
}
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"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -114,7 +114,7 @@ func BenchmarkEncode(b *testing.B) {
}

func BenchmarkExample(b *testing.B) {
d, err := ioutil.ReadFile("_example/example.toml")
d, err := os.ReadFile("_example/example.toml")
if err != nil {
b.Fatal(err)
}
Expand Down
3 changes: 1 addition & 2 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"reflect"
Expand Down Expand Up @@ -148,7 +147,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 := ioutil.ReadAll(dec.r)
data, err := io.ReadAll(dec.r)
if err != nil {
return MetaData{}, err
}
Expand Down
5 changes: 2 additions & 3 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"math"
"os"
"reflect"
Expand All @@ -31,7 +30,7 @@ func TestDecodeReader(t *testing.T) {
}

func TestDecodeFile(t *testing.T) {
tmp, err := ioutil.TempFile("", "toml-")
tmp, err := os.CreateTemp("", "toml-")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1126,7 +1125,7 @@ func TestCustomDecode(t *testing.T) {
Slice = ["text1", "text2"]
`, &outer)
if err != nil {
t.Fatal(fmt.Sprintf("Decode failed: %s", err))
t.Fatalf("Decode failed: %s", err)
}

if outer.Int.value != 10 {
Expand Down
1 change: 1 addition & 0 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ 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.
Expand Down

0 comments on commit 183c821

Please sign in to comment.