Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Nov 3, 2021
1 parent 1608551 commit 7434d73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func init() {
hexDigits[i] = byte((i - 'A') + 10)
}
types = make([]Type, 256)
for i := 0; i < len(types); i++ {
for i := range types {
types[i] = Invalid
}
types['"'] = String
Expand Down
9 changes: 4 additions & 5 deletions float_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_read_float(t *testing.T) {
}
for _, input := range inputs {
// non-streaming
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
r := DecodeStr(input + ",")
expected, err := strconv.ParseFloat(input, 32)
Expand All @@ -74,7 +74,7 @@ func Test_read_float(t *testing.T) {
should.NoError(err)
should.Equal(float32(expected), got)
})
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
r := DecodeStr(input + ",")
expected, err := strconv.ParseFloat(input, 64)
Expand All @@ -83,8 +83,7 @@ func Test_read_float(t *testing.T) {
should.NoError(err)
should.Equal(expected, got)
})
// streaming
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := Decode(bytes.NewBufferString(input+","), 2)
expected, err := strconv.ParseFloat(input, 32)
Expand All @@ -93,7 +92,7 @@ func Test_read_float(t *testing.T) {
should.NoError(err)
should.Equal(float32(expected), got)
})
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := Decode(bytes.NewBufferString(input+","), 2)
val := float64(0)
Expand Down
8 changes: 4 additions & 4 deletions int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestDecoder_int_numbers(t *testing.T) {
func Test_read_int32(t *testing.T) {
inputs := []string{`1`, `12`, `123`, `1234`, `12345`, `123456`, `2147483647`, `-2147483648`}
for _, input := range inputs {
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := DecodeStr(input)
expected, err := strconv.ParseInt(input, 10, 32)
Expand All @@ -84,7 +84,7 @@ func Test_read_int32(t *testing.T) {
should.NoError(err)
should.Equal(int32(expected), v)
})
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := Decode(bytes.NewBufferString(input), 2)
expected, err := strconv.ParseInt(input, 10, 32)
Expand Down Expand Up @@ -177,7 +177,7 @@ func Test_read_int64_overflow(t *testing.T) {
func Test_read_int64(t *testing.T) {
inputs := []string{`1`, `12`, `123`, `1234`, `12345`, `123456`, `9223372036854775807`, `-9223372036854775808`}
for _, input := range inputs {
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := DecodeStr(input)
expected, err := strconv.ParseInt(input, 10, 64)
Expand All @@ -186,7 +186,7 @@ func Test_read_int64(t *testing.T) {
should.NoError(err)
should.Equal(expected, v)
})
t.Run(fmt.Sprintf("%v", input), func(t *testing.T) {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := Decode(bytes.NewBufferString(input), 2)
expected, err := strconv.ParseInt(input, 10, 64)
Expand Down

0 comments on commit 7434d73

Please sign in to comment.