Skip to content

Commit

Permalink
golint ++/--
Browse files Browse the repository at this point in the history
  • Loading branch information
zerosnake0 committed Oct 8, 2020
1 parent 56ca2d3 commit c2fac56
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 92 deletions.
16 changes: 8 additions & 8 deletions iterator_array.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func (it *Iterator) ReadArrayBegin() (ret bool, err error) {
if c != '[' {
return false, UnexpectedByteError{got: c, exp: '['}
}
it.head += 1
it.head++
c, err = it.nextToken()
if err != nil {
return false, err
}
if c == ']' {
it.head += 1
it.head++
return false, nil
}
return true, nil
Expand All @@ -40,10 +40,10 @@ func (it *Iterator) ReadArrayMore() (ret bool, err error) {
}
switch c {
case ',':
it.head += 1
it.head++
return true, nil
case ']':
it.head += 1
it.head++
return false, nil
default:
return false, UnexpectedByteError{got: c, exp: ',', exp2: ']'}
Expand All @@ -58,13 +58,13 @@ func (it *Iterator) ReadArrayCB(cb func(*Iterator) error) error {
if c != '[' {
return UnexpectedByteError{got: c, exp: '['}
}
it.head += 1
it.head++
c, err = it.nextToken()
if err != nil {
return err
}
if c == ']' {
it.head += 1
it.head++
return nil
}
for {
Expand All @@ -77,9 +77,9 @@ func (it *Iterator) ReadArrayCB(cb func(*Iterator) error) error {
}
switch c {
case ',':
it.head += 1
it.head++
case ']':
it.head += 1
it.head++
return nil
default:
return UnexpectedByteError{got: c, exp: ',', exp2: ']'}
Expand Down
14 changes: 7 additions & 7 deletions iterator_float32.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ func (it *Iterator) ReadFloat32() (float32, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
if c == '-' {
c, err = it.nextByte()
if err != nil {
return 0, err
}
it.head += 1
it.head++
f, buf, err := it.readPositiveFloat32(c, it.tmpBuffer[:0])
it.tmpBuffer = buf
return -f, err
Expand All @@ -36,14 +36,14 @@ func (it *Iterator) readFloat32ExponentPart(buf []byte) (ret float32, _ []byte,
if err != nil {
return 0, buf, err
}
it.head += 1
it.head++
if c == '+' || c == '-' {
buf = append(buf, c)
c, err = it.nextByte()
if err != nil {
return 0, buf, err
}
it.head += 1
it.head++
}
if intDigits[c] == invalidDigit {
return 0, buf, InvalidFloatError{c: c}
Expand Down Expand Up @@ -82,7 +82,7 @@ func (it *Iterator) readFloat32FractionPart(buf []byte) (ret float32, _ []byte,
if intDigits[c] == invalidDigit {
return 0, buf, InvalidFloatError{c: c}
}
it.head += 1
it.head++
buf = append(buf, c)
for {
i := it.head
Expand Down Expand Up @@ -134,11 +134,11 @@ func (it *Iterator) readPositiveFloat32(c byte, buf []byte) (ret float32, _ []by
}
switch floatDigits[it.buffer[it.head]] {
case dotInNumber:
it.head += 1
it.head++
buf = append(buf, '.')
return it.readFloat32FractionPart(buf)
case expInNumber:
it.head += 1
it.head++
buf = append(buf, 'e')
return it.readFloat32ExponentPart(buf)
default:
Expand Down
6 changes: 3 additions & 3 deletions iterator_int16.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (it *Iterator) ReadUint16() (uint16, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
return it.readUint16(c)
}

Expand Down Expand Up @@ -66,7 +66,7 @@ func (it *Iterator) readInt16(c byte) (int16, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
v, err := it.readUint16(c)
if err != nil {
return 0, err
Expand Down Expand Up @@ -98,6 +98,6 @@ func (it *Iterator) ReadInt16() (int16, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
return it.readInt16(c)
}
6 changes: 3 additions & 3 deletions iterator_int64.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (it *Iterator) ReadUint64() (uint64, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
return it.readUint64(c)
}

Expand Down Expand Up @@ -67,7 +67,7 @@ func (it *Iterator) readInt64(c byte) (int64, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
v, err := it.readUint64(c)
if err != nil {
return 0, err
Expand Down Expand Up @@ -99,6 +99,6 @@ func (it *Iterator) ReadInt64() (int64, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
return it.readInt64(c)
}
10 changes: 5 additions & 5 deletions iterator_int8.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (it *Iterator) ReadUint8() (uint8, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
return it.readUint8(c)
}

Expand All @@ -42,7 +42,7 @@ func (it *Iterator) readUint8(c byte) (ret uint8, err error) {
return
}
ret = (ret << 3) + (ret << 1) + uint8(u)
it.head += 1
it.head++
if it.head == it.tail {
if err = it.readMore(); err != nil {
if err == io.EOF {
Expand All @@ -55,7 +55,7 @@ func (it *Iterator) readUint8(c byte) (ret uint8, err error) {
if u == invalidDigit {
return
}
it.head += 1
it.head++
if ret > maxUint8Div10 ||
(ret == maxUint8Div10 && u > maxUint8Mod10) {
err = IntOverflowError{}
Expand All @@ -71,7 +71,7 @@ func (it *Iterator) readInt8(c byte) (int8, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
v, err := it.readUint8(c)
if err != nil {
return 0, err
Expand Down Expand Up @@ -103,6 +103,6 @@ func (it *Iterator) ReadInt8() (int8, error) {
if err != nil {
return 0, err
}
it.head += 1
it.head++
return it.readInt8(c)
}
2 changes: 1 addition & 1 deletion iterator_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func (it *Iterator) SkipRaw() ([]byte, error) {
oldCapture := it.capture
it.capture = true
begin := it.head
it.head += 1
it.head++
err = skipFunctions[c](it, c)
it.capture = oldCapture
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions iterator_skip.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func skipWithStack(it *Iterator, top stackElement, s *stack) (err error) {
if err != nil {
return err
}
it.head += 1
it.head++
if top&1 == 0 {
// stackElementObjectBegin
// stackElementObject
Expand All @@ -55,7 +55,7 @@ func skipWithStack(it *Iterator, top stackElement, s *stack) (err error) {
if err != nil {
return err
}
it.head += 1
it.head++
}
if c != '"' {
return UnexpectedByteError{got: c, exp: '"'}
Expand All @@ -66,7 +66,7 @@ func skipWithStack(it *Iterator, top stackElement, s *stack) (err error) {
if c, err = it.nextToken(); err != nil {
return err
}
it.head += 1
it.head++
switch c {
case '[':
s.pushObject()
Expand Down Expand Up @@ -97,7 +97,7 @@ func skipWithStack(it *Iterator, top stackElement, s *stack) (err error) {
if err != nil {
return err
}
it.head += 1
it.head++
}
switch c {
case '[':
Expand All @@ -121,6 +121,6 @@ func (it *Iterator) Skip() error {
if err != nil {
return err
}
it.head += 1
it.head++
return skipFunctions[c](it, c)
}
14 changes: 7 additions & 7 deletions val_decoder_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ func (*boolDecoder) Decode(ptr unsafe.Pointer, it *Iterator, opts *DecOpts) erro
}
switch c {
case 'n':
it.head += 1
it.head++
return it.expectBytes("ull")
case 't':
it.head += 1
it.head++
if err := it.expectBytes("rue"); err != nil {
return err
}
*(*bool)(ptr) = true
return nil
case 'f':
it.head += 1
it.head++
if err := it.expectBytes("alse"); err != nil {
return err
}
Expand All @@ -36,12 +36,12 @@ func (*boolDecoder) Decode(ptr unsafe.Pointer, it *Iterator, opts *DecOpts) erro
if !quoted {
return UnexpectedByteError{got: c}
}
it.head += 1
it.head++
c, err := it.nextToken()
if err != nil {
return err
}
it.head += 1
it.head++
switch c {
case 't':
if err := it.expectBytes(`rue"`); err != nil {
Expand Down Expand Up @@ -75,7 +75,7 @@ func (*stringDecoder) Decode(ptr unsafe.Pointer, it *Iterator, opts *DecOpts) er
}
switch c {
case '"':
it.head += 1
it.head++
s, err := it.readString()
if err != nil {
return err
Expand Down Expand Up @@ -118,7 +118,7 @@ func (*stringDecoder) Decode(ptr unsafe.Pointer, it *Iterator, opts *DecOpts) er
return BadQuotedStringError(s)
}
case 'n':
it.head += 1
it.head++
return it.expectBytes("ull")
default:
return UnexpectedByteError{got: c, exp: '"', exp2: 'n'}
Expand Down
10 changes: 5 additions & 5 deletions val_decoder_native_array.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ func (dec *arrayDecoder) Decode(ptr unsafe.Pointer, it *Iterator, _ *DecOpts) er
return err
}
if c == 'n' {
it.head += 1
it.head++
return it.expectBytes("ull")
}
if c != '[' {
return UnexpectedByteError{got: c, exp: '[', exp2: 'n'}
}
it.head += 1
it.head++
c, err = it.nextToken()
if err != nil {
return err
}
count := 0
var offset uintptr = 0
if c == ']' {
it.head += 1
it.head++
} else {
for {
if count < dec.length {
Expand All @@ -68,7 +68,7 @@ func (dec *arrayDecoder) Decode(ptr unsafe.Pointer, it *Iterator, _ *DecOpts) er
if err := dec.elemDec.Decode(elemPtr, it, nil); err != nil {
return err
}
count += 1
count++
offset += dec.elemSize
} else {
if err := it.Skip(); err != nil {
Expand All @@ -79,7 +79,7 @@ func (dec *arrayDecoder) Decode(ptr unsafe.Pointer, it *Iterator, _ *DecOpts) er
if err != nil {
return err
}
it.head += 1
it.head++
if c == ']' {
break
}
Expand Down
4 changes: 2 additions & 2 deletions val_decoder_native_float.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (*float32Decoder) Decode(ptr unsafe.Pointer, it *Iterator, _ *DecOpts) erro
return err
}
if c == 'n' {
it.head += 1
it.head++
return it.expectBytes("ull")
}
f, err := it.ReadFloat32()
Expand All @@ -35,7 +35,7 @@ func (*float64Decoder) Decode(ptr unsafe.Pointer, it *Iterator, _ *DecOpts) erro
return err
}
if c == 'n' {
it.head += 1
it.head++
return it.expectBytes("ull")
}
f, err := it.ReadFloat64()
Expand Down
Loading

0 comments on commit c2fac56

Please sign in to comment.