Skip to content

Commit 199b07c

Browse files
authored
Merge pull request #91 from hyp3rd/chore/deps-updates-260313
chore(go,deps): bump to Go 1.26.1; update tooling; migrate sort to slices.SortFunc
2 parents abcd5c6 + 50e276e commit 199b07c

11 files changed

Lines changed: 70 additions & 47 deletions

File tree

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ run:
4242
# Define the Go version limit.
4343
# Mainly related to generics support since go1.18.
4444
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
45-
go: "1.26.0"
45+
go: "1.26.1"
4646

4747
linters:
4848
# Enable specific linter

.pre-commit/golangci-lint-hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [[ -f "${ROOT_DIR}/.project-settings.env" ]]; then
2323
# shellcheck disable=SC1090
2424
source "${ROOT_DIR}/.project-settings.env"
2525
fi
26-
GOLANGCI_LINT_VERSION="${GOLANGCI_LINT_VERSION:-v2.10.1}"
26+
GOLANGCI_LINT_VERSION="${GOLANGCI_LINT_VERSION:-v2.11.3}"
2727

2828
# #######################################
2929
# Install dependencies to run the pre-commit hook

.pre-commit/unit-test-hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ hook() {
2121
local root_dir
2222
root_dir=$(git rev-parse --show-toplevel)
2323

24-
local toolchain_version="1.26.0"
24+
local toolchain_version="1.26.1"
2525
if [[ -f "${root_dir}/.project-settings.env" ]]; then
2626
# shellcheck disable=SC1090
2727
source "${root_dir}/.project-settings.env"

.project-settings.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
GOLANGCI_LINT_VERSION=v2.10.1
2-
BUF_VERSION=v1.66.0
3-
GO_VERSION=1.26.0
1+
GOLANGCI_LINT_VERSION=v2.11.3
2+
BUF_VERSION=v1.66.1
3+
GO_VERSION=1.26.1
44
GCI_PREFIX=github.com/hyp3rd/hypercache
55
PROTO_ENABLED=false

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
include .project-settings.env
22

3-
GOLANGCI_LINT_VERSION ?= v2.10.1
4-
BUF_VERSION ?= v1.66.0
5-
GO_VERSION ?= 1.26.0
3+
GOLANGCI_LINT_VERSION ?= v2.11.3
4+
BUF_VERSION ?= v1.66.1
5+
GO_VERSION ?= 1.26.1
66
GCI_PREFIX ?= github.com/hyp3rd/hypercache
77
PROTO_ENABLED ?= true
88

go.mod

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
module github.com/hyp3rd/hypercache
22

3-
go 1.26.0
3+
go 1.26.1
44

55
require (
66
github.com/cespare/xxhash/v2 v2.3.0
7-
github.com/goccy/go-json v0.10.5
7+
github.com/goccy/go-json v0.10.6
88
github.com/gofiber/fiber/v3 v3.1.0
9-
github.com/hyp3rd/ewrap v1.3.7
9+
github.com/hyp3rd/ewrap v1.3.8
1010
github.com/hyp3rd/sectools v1.2.3
1111
github.com/longbridgeapp/assert v1.1.0
1212
github.com/redis/go-redis/v9 v9.18.0
13-
github.com/shamaton/msgpack/v2 v2.4.0
13+
github.com/shamaton/msgpack/v3 v3.1.0
1414
github.com/ugorji/go/codec v1.3.1
15-
go.opentelemetry.io/otel v1.40.0
16-
go.opentelemetry.io/otel/metric v1.40.0
17-
go.opentelemetry.io/otel/trace v1.40.0
15+
go.opentelemetry.io/otel v1.42.0
16+
go.opentelemetry.io/otel/metric v1.42.0
17+
go.opentelemetry.io/otel/trace v1.42.0
1818
)
1919

2020
require (
@@ -36,10 +36,10 @@ require (
3636
github.com/valyala/bytebufferpool v1.0.0 // indirect
3737
github.com/valyala/fasthttp v1.69.0 // indirect
3838
go.uber.org/atomic v1.11.0 // indirect
39-
golang.org/x/crypto v0.48.0 // indirect
40-
golang.org/x/net v0.51.0 // indirect
41-
golang.org/x/sys v0.41.0 // indirect
42-
golang.org/x/text v0.34.0 // indirect
39+
golang.org/x/crypto v0.49.0 // indirect
40+
golang.org/x/net v0.52.0 // indirect
41+
golang.org/x/sys v0.42.0 // indirect
42+
golang.org/x/text v0.35.0 // indirect
4343
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
4444
gopkg.in/yaml.v3 v3.0.1 // indirect
4545
)

go.sum

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
1717
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
1818
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
1919
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
20-
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
21-
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
20+
github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU=
21+
github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
2222
github.com/gofiber/fiber/v3 v3.1.0 h1:1p4I820pIa+FGxfwWuQZ5rAyX0WlGZbGT6Hnuxt6hKY=
2323
github.com/gofiber/fiber/v3 v3.1.0/go.mod h1:n2nYQovvL9z3Too/FGOfgtERjW3GQcAUqgfoezGBZdU=
2424
github.com/gofiber/schema v1.7.0 h1:yNM+FNRZjyYEli9Ey0AXRBrAY9jTnb+kmGs3lJGPvKg=
@@ -29,8 +29,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
2929
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
3030
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
3131
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
32-
github.com/hyp3rd/ewrap v1.3.7 h1:3uS7osww2dHI/08/rihGdtEzaSSgdtH4l9HubtMe6Io=
33-
github.com/hyp3rd/ewrap v1.3.7/go.mod h1:9IhBgb6LhJDrgVNdx4vZ9SIw6eXxiopjZb2HvbG8pgA=
32+
github.com/hyp3rd/ewrap v1.3.8 h1:36IYDgSWI5wG85G+CIwE7WvU5xi+FJvT8KWR8YVT+cA=
33+
github.com/hyp3rd/ewrap v1.3.8/go.mod h1:ly3lreW7OWbBaX9I4zTKqctJlf9uxNQiUD5zXl2vz4g=
3434
github.com/hyp3rd/sectools v1.2.3 h1:XElGIhLOWPJxVLyLPzfKASYjs+3yEkDN48JeSw/Wvjo=
3535
github.com/hyp3rd/sectools v1.2.3/go.mod h1:iwl65boK1VNhwvRNSQDItdD5xon8W1l+ox4JFTe5WbI=
3636
github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
@@ -60,8 +60,6 @@ github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQ
6060
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
6161
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
6262
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
63-
github.com/shamaton/msgpack/v2 v2.4.0 h1:O5Z08MRmbo0lA9o2xnQ4TXx6teJbPqEurqcCOQ8Oi/4=
64-
github.com/shamaton/msgpack/v2 v2.4.0/go.mod h1:6khjYnkx73f7VQU7wjcFS9DFjs+59naVWJv1TB7qdOI=
6563
github.com/shamaton/msgpack/v3 v3.1.0 h1:jsk0vEAqVvvS9+fTZ5/EcQ9tz860c9pWxJ4Iwecz8gU=
6664
github.com/shamaton/msgpack/v3 v3.1.0/go.mod h1:DcQG8jrdrQCIxr3HlMYkiXdMhK+KfN2CitkyzsQV4uc=
6765
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
@@ -84,23 +82,23 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
8482
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
8583
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
8684
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
87-
go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms=
88-
go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g=
89-
go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g=
90-
go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc=
91-
go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw=
92-
go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA=
85+
go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
86+
go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
87+
go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
88+
go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
89+
go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
90+
go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
9391
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
9492
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
95-
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
96-
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
97-
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
98-
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
93+
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
94+
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
95+
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
96+
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
9997
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
100-
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
101-
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
102-
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
103-
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
98+
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
99+
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
100+
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
101+
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
104102
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
105103
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
106104
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

internal/cluster/ring.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cluster
22

33
import (
44
"fmt"
5+
"slices"
56
"sort"
67
"sync"
78

@@ -77,7 +78,17 @@ func (r *Ring) Build(nodes []*Node) {
7778
}
7879
}
7980

80-
sort.Slice(vn, func(i, j int) bool { return vn[i].hash < vn[j].hash })
81+
slices.SortFunc(vn, func(a, b vnode) int {
82+
switch {
83+
case a.hash < b.hash:
84+
return -1
85+
case a.hash > b.hash:
86+
return 1
87+
default:
88+
return 0
89+
}
90+
})
91+
8192
r.mu.Lock()
8293

8394
r.vnodes = vn

internal/libs/serializer/msgpack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package serializer
22

33
import (
44
"github.com/hyp3rd/ewrap"
5-
"github.com/shamaton/msgpack/v2"
5+
"github.com/shamaton/msgpack/v3"
66
)
77

88
// MsgpackSerializer leverages `msgpack` to serialize the items before storing them in the cache.

pkg/backend/dist_memory.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"hash/fnv"
1111
"math/big"
1212
"slices"
13-
"sort"
13+
"strings"
1414
"sync"
1515
"sync/atomic"
1616
"time"
@@ -307,7 +307,9 @@ func (dm *DistMemory) BuildMerkleTree() *MerkleTree { //nolint:ireturn
307307
return &MerkleTree{ChunkSize: chunkSize}
308308
}
309309

310-
sort.Slice(entries, func(i, j int) bool { return entries[i].k < entries[j].k })
310+
slices.SortFunc(entries, func(a, b merkleKV) int {
311+
return strings.Compare(a.k, b.k)
312+
})
311313

312314
hasher := sha256.New()
313315
buf := make([]byte, merkleVersionBytes)
@@ -1182,7 +1184,10 @@ func (dm *DistMemory) RemovePeer(address string) { //nolint:ireturn
11821184
// sortedMerkleEntries returns merkle entries sorted by key.
11831185
func (dm *DistMemory) sortedMerkleEntries() []merkleKV { //nolint:ireturn
11841186
entries := dm.merkleEntries()
1185-
sort.Slice(entries, func(i, j int) bool { return entries[i].k < entries[j].k })
1187+
1188+
slices.SortFunc(entries, func(a, b merkleKV) int {
1189+
return strings.Compare(a.k, b.k)
1190+
})
11861191

11871192
return entries
11881193
}

0 commit comments

Comments
 (0)