Skip to content

Commit caadc24

Browse files
committed
chore: Fix golang lint errors
1 parent 06042a0 commit caadc24

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

cycbuf.go

-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ type CycBuf struct {
2020
i int
2121
}
2222

23-
func newCycBuf(t Typ, n, i int) *CycBuf {
24-
return &CycBuf{newFixBuf(t, n), i}
25-
}
26-
2723
func (b *CycBuf) put(ixs interface{}) {
2824
if xs, ok := ixs.([]interface{}); ok {
2925
for _, x := range xs {

parse.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ const (
3333
EXABYTE
3434
)
3535

36-
var invalidByteSizeError = errors.New("invalid byte size")
36+
var errInvalidByteSize = errors.New("invalid byte size")
3737

3838
// ParseBytes parses string representations (e.g. 42K or 42KB or 42KiB) to bytes
3939
func ParseBytes(s string) (uint64, error) {
4040
s = strings.ToUpper(strings.TrimSpace(s))
4141
i := strings.IndexFunc(s, unicode.IsLetter)
4242

4343
if i == -1 {
44-
return 0, invalidByteSizeError
44+
return 0, errInvalidByteSize
4545
}
4646

4747
num, unit := s[:i], s[i:]
4848
b, err := strconv.ParseFloat(num, 64)
4949
if err != nil || b < 0 {
50-
return 0, invalidByteSizeError
50+
return 0, errInvalidByteSize
5151
}
5252

5353
switch unit {
@@ -66,6 +66,6 @@ func ParseBytes(s string) (uint64, error) {
6666
case "B":
6767
return uint64(b), nil
6868
default:
69-
return 0, invalidByteSizeError
69+
return 0, errInvalidByteSize
7070
}
7171
}

parse_test.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ import (
2020
"github.com/h2oai/wave/pkg/assert"
2121
)
2222

23-
type parseBytesTestCase struct {
24-
input string
25-
output uint64
26-
}
27-
2823
func TestParseBytes(t *testing.T) {
2924
_, ok, no := assert.Assert(t)
3025
units := []string{"e", "p", "t", "g", "m", "k"}
@@ -38,7 +33,7 @@ func TestParseBytes(t *testing.T) {
3833

3934
b, err = ParseBytes("0" + unit)
4035
no(err)
41-
ok(0 == b, "zero")
36+
ok(b == 0, "zero")
4237

4338
b, err = ParseBytes("5" + unit + "b")
4439
no(err)

0 commit comments

Comments
 (0)