[#1525] pilorama: Use AppendUint* helpers from stdlib
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 2m6s
DCO action / DCO (pull_request) Successful in 2m24s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m54s
Vulncheck / Vulncheck (pull_request) Successful in 2m49s
Build / Build Components (pull_request) Successful in 3m13s
Tests and linters / gopls check (pull_request) Successful in 3m23s
Tests and linters / Staticcheck (pull_request) Successful in 3m54s
Tests and linters / Lint (pull_request) Successful in 4m41s
Tests and linters / Tests (pull_request) Successful in 4m56s
Tests and linters / Tests with -race (pull_request) Successful in 5m57s
Tests and linters / Run gofumpt (push) Successful in 3m4s
Vulncheck / Vulncheck (push) Successful in 3m23s
Tests and linters / Staticcheck (push) Successful in 3m51s
Build / Build Components (push) Successful in 4m21s
Pre-commit hooks / Pre-commit (push) Successful in 4m41s
Tests and linters / gopls check (push) Successful in 4m41s
Tests and linters / Tests with -race (push) Successful in 5m15s
Tests and linters / Lint (push) Successful in 5m56s
Tests and linters / Tests (push) Successful in 6m7s

gopatch:
```
@@
var slice, e expression
@@
+import "encoding/binary"

-append(slice, byte(e), byte(e >> 8))
+binary.LittleEndian.AppendUint16(slice, e)
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-11-28 09:15:29 +03:00
parent aac65001e5
commit 01acec708f
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg

View file

@ -1240,7 +1240,7 @@ func (t *boltForest) fillSortedChildren(b *bbolt.Bucket, nodeIDs MultiNode, h *f
nodes = nil nodes = nil
length = actualLength + 1 length = actualLength + 1
count = 0 count = 0
c.Seek(append(prefix, byte(length), byte(length>>8))) c.Seek(binary.LittleEndian.AppendUint16(prefix, length))
c.Prev() // c.Next() will be performed by for loop c.Prev() // c.Next() will be performed by for loop
} }
} }
@ -1664,7 +1664,7 @@ func internalKeyPrefix(key []byte, k string) []byte {
key = append(key, 'i') key = append(key, 'i')
l := len(k) l := len(k)
key = append(key, byte(l), byte(l>>8)) key = binary.LittleEndian.AppendUint16(key, uint16(l))
key = append(key, k...) key = append(key, k...)
return key return key
} }
@ -1679,14 +1679,10 @@ func internalKey(key []byte, k, v string, parent, node Node) []byte {
key = internalKeyPrefix(key, k) key = internalKeyPrefix(key, k)
l := len(v) l := len(v)
key = append(key, byte(l), byte(l>>8)) key = binary.LittleEndian.AppendUint16(key, uint16(l))
key = append(key, v...) key = append(key, v...)
var raw [8]byte key = binary.LittleEndian.AppendUint64(key, parent)
binary.LittleEndian.PutUint64(raw[:], parent) key = binary.LittleEndian.AppendUint64(key, node)
key = append(key, raw[:]...)
binary.LittleEndian.PutUint64(raw[:], node)
key = append(key, raw[:]...)
return key return key
} }