Skip to content

Commit

Permalink
fix: linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma committed Sep 25, 2024
1 parent b86b364 commit 303537c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions codec_fixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ type fixedCodec struct {
}

func (c *fixedCodec) Decode(ptr unsafe.Pointer, r *Reader) {
for i := 0; i < c.arrayType.Len(); i++ {
for i := range c.arrayType.Len() {
c.arrayType.UnsafeSetIndex(ptr, i, reflect2.PtrOf(r.readByte()))
}
}

func (c *fixedCodec) Encode(ptr unsafe.Pointer, w *Writer) {
for i := 0; i < c.arrayType.Len(); i++ {
for i := range c.arrayType.Len() {
bytePtr := c.arrayType.UnsafeGetIndex(ptr, i)
w.writeByte(*((*byte)(bytePtr)))
}
Expand Down
4 changes: 2 additions & 2 deletions codec_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (d *mapDecoder) Decode(ptr unsafe.Pointer, r *Reader) {
break
}

for i := int64(0); i < l; i++ {
for range l {
keyPtr := reflect2.PtrOf(r.ReadString())
elemPtr := d.elemType.UnsafeNew()
d.decoder.Decode(elemPtr, r)
Expand Down Expand Up @@ -115,7 +115,7 @@ func (d *mapDecoderUnmarshaler) Decode(ptr unsafe.Pointer, r *Reader) {
break
}

for i := int64(0); i < l; i++ {
for range l {
keyPtr := d.keyType.UnsafeNew()
keyObj := d.keyType.UnsafeIndirect(keyPtr)
if reflect2.IsNil(keyObj) {
Expand Down
2 changes: 1 addition & 1 deletion codec_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ func describeStruct(tagKey string, typ reflect2.Type) *structDescriptor {
}
visited[rtype] = true

for i := 0; i < f.anon.NumField(); i++ {
for i := range f.anon.NumField() {
field := f.anon.Field(i).(*reflect2.UnsafeStructField)
isUnexported := field.PkgPath() != ""

Expand Down
4 changes: 2 additions & 2 deletions codec_skip.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (d *sliceSkipDecoder) Decode(_ unsafe.Pointer, r *Reader) {
continue
}

for i := 0; i < int(l); i++ {
for range l {
d.decoder.Decode(nil, r)
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ func (d *mapSkipDecoder) Decode(_ unsafe.Pointer, r *Reader) {
continue
}

for i := 0; i < int(l); i++ {
for range l {
r.SkipString()
d.decoder.Decode(nil, r)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/crc64/crc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type Table [256]uint64

func makeTable() *Table {
t := new(Table)
for i := 0; i < 256; i++ {
for i := range 256 {
fp := uint64(i)
for j := 0; j < 8; j++ {
for range 8 {
fp = (fp >> 1) ^ (Empty & -(fp & 1))
}
t[i] = fp
Expand Down Expand Up @@ -68,7 +68,7 @@ func (d *digest) Reset() {

// Write accumulatively adds the given data to the checksum.
func (d *digest) Write(p []byte) (n int, err error) {
for i := 0; i < len(p); i++ {
for i := range p {
d.crc = (d.crc >> 8) ^ d.tab[(int)(byte(d.crc)^p[i])&0xff]
}

Expand Down
4 changes: 2 additions & 2 deletions reader_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (r *Reader) ReadArrayCB(fn func(*Reader) bool) {
if l == 0 {
break
}
for i := 0; i < int(l); i++ {
for range l {
fn(r)
}
}
Expand All @@ -147,7 +147,7 @@ func (r *Reader) ReadMapCB(fn func(*Reader, string) bool) {
break
}

for i := 0; i < int(l); i++ {
for range l {
field := r.ReadString()
fn(r, field)
}
Expand Down
2 changes: 1 addition & 1 deletion schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ func isValidDefaultBytes(def string) ([]byte, bool) {
runes := []rune(def)
l := len(runes)
b := make([]byte, l)
for i := 0; i < l; i++ {
for i := range l {
if runes[i] < 0 || runes[i] > 255 {
return nil, false
}
Expand Down

0 comments on commit 303537c

Please sign in to comment.