diff --git a/.github/actions/setup-go/action.yaml b/.github/actions/setup-go/action.yaml index 35b851d..6d27e30 100644 --- a/.github/actions/setup-go/action.yaml +++ b/.github/actions/setup-go/action.yaml @@ -5,7 +5,7 @@ inputs: go-version: description: 'Go version to use' required: false - default: '1.24' + default: '1.25' cache: description: 'Enable Go module cache' required: false diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 161fd94..c2fbc78 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: ['1.24'] + go-version: ['1.25'] steps: - name: Checkout code @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: ['1.24'] + go-version: ['1.25'] steps: - name: Checkout code diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9a265e4..4ff9166 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -21,7 +21,7 @@ jobs: - name: Setup Go uses: ./.github/actions/setup-go with: - go-version: '1.24' + go-version: '1.25' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 diff --git a/go.mod b/go.mod index 94647fb..6363565 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,16 @@ module github.com/8thgencore/valchemy -go 1.24.5 +go 1.25.6 require ( - github.com/alecthomas/kong v1.12.0 + github.com/alecthomas/kong v1.14.0 github.com/golang-cz/devslog v0.0.15 github.com/ilyakaznacheev/cleanenv v1.5.0 - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.11.1 ) require ( - github.com/BurntSushi/toml v1.5.0 // indirect + github.com/BurntSushi/toml v1.6.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/joho/godotenv v1.5.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/go.sum b/go.sum index 72af24d..075c9f4 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,14 @@ github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= -github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= -github.com/alecthomas/kong v1.10.0 h1:8K4rGDpT7Iu+jEXCIJUeKqvpwZHbsFRoebLbnzlmrpw= -github.com/alecthomas/kong v1.10.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= -github.com/alecthomas/kong v1.12.0 h1:oKd/0fHSdajj5PfGDd3ScvEvpVJf9mT2mb5r9xYadYM= -github.com/alecthomas/kong v1.12.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= -github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= -github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/kong v1.14.0 h1:gFgEUZWu2ZmZ+UhyZ1bDhuutbKN1nTtJTwh19Wsn21s= +github.com/alecthomas/kong v1.14.0/go.mod h1:wrlbXem1CWqUV5Vbmss5ISYhsVPkBb1Yo7YKJghju2I= +github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs= +github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang-cz/devslog v0.0.13 h1:JkJ6PPNSOCBpYyU03v3xw7WgpChQ3AYFqgRbYBhUk/Y= -github.com/golang-cz/devslog v0.0.13/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= github.com/golang-cz/devslog v0.0.15 h1:ejoBLTCwJHWGbAmDf2fyTJJQO3AkzcPjw8SC9LaOQMI= github.com/golang-cz/devslog v0.0.15/go.mod h1:bSe5bm0A7Nyfqtijf1OMNgVJHlWEuVSXnkuASiE1vV8= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= @@ -23,8 +19,8 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/config/utils.go b/internal/config/utils.go index 5d5415e..70935ad 100644 --- a/internal/config/utils.go +++ b/internal/config/utils.go @@ -34,8 +34,8 @@ func parseSize(sizeStr string) (uint64, error) { found := false for _, s := range suffixes { - if strings.HasSuffix(sizeStr, s.suffix) { - numStr = strings.TrimSuffix(sizeStr, s.suffix) + if before, ok := strings.CutSuffix(sizeStr, s.suffix); ok { + numStr = before mult = s.mult found = true break diff --git a/internal/replication/replication_test.go b/internal/replication/replication_test.go index 1cdfe4a..beea38b 100644 --- a/internal/replication/replication_test.go +++ b/internal/replication/replication_test.go @@ -1,5 +1,4 @@ //go:build !unit -// +build !unit package replication diff --git a/internal/storage/engine.go b/internal/storage/engine.go index b6884fa..895cb8c 100644 --- a/internal/storage/engine.go +++ b/internal/storage/engine.go @@ -33,7 +33,7 @@ func NewEngine(log *slog.Logger, w wal.WAL) *Engine { } // Initialize partitions - for i := 0; i < defaultNumShards; i++ { + for i := range defaultNumShards { e.partitions[i] = &partition{ data: make(map[string]string), } diff --git a/internal/storage/engine_test.go b/internal/storage/engine_test.go index a181a46..a5e4d90 100644 --- a/internal/storage/engine_test.go +++ b/internal/storage/engine_test.go @@ -121,7 +121,7 @@ func TestEngine(t *testing.T) { const iterations = 100 go func() { - for i := 0; i < iterations; i++ { + for i := range iterations { _ = engine.Set(fmt.Sprintf("key%d", i), "value") engine.Get(fmt.Sprintf("key%d", i)) } @@ -129,7 +129,7 @@ func TestEngine(t *testing.T) { }() go func() { - for i := 0; i < iterations; i++ { + for i := range iterations { engine.Get(fmt.Sprintf("key%d", i)) _ = engine.Delete(fmt.Sprintf("key%d", i)) } @@ -150,7 +150,7 @@ func TestEngine(t *testing.T) { go func() { defer wg.Done() - for i := 0; i < iterations; i++ { + for i := range iterations { err := engine.Set("key", fmt.Sprintf("value1_%d", i)) require.NoError(t, err) } @@ -158,7 +158,7 @@ func TestEngine(t *testing.T) { go func() { defer wg.Done() - for i := 0; i < iterations; i++ { + for i := range iterations { err := engine.Set("key", fmt.Sprintf("value2_%d", i)) require.NoError(t, err) } diff --git a/internal/wal/segment/segment_test.go b/internal/wal/segment/segment_test.go index cbe3b2b..33bb3d6 100644 --- a/internal/wal/segment/segment_test.go +++ b/internal/wal/segment/segment_test.go @@ -124,7 +124,7 @@ func TestListSegments(t *testing.T) { defer os.RemoveAll(dir) // Create several segments - for i := 0; i < 3; i++ { + for range 3 { s, err := NewSegment(dir) require.NoError(t, err) err = s.CreateSegmentFile() diff --git a/internal/wal/wal_test.go b/internal/wal/wal_test.go index 6a82a74..fb63c61 100644 --- a/internal/wal/wal_test.go +++ b/internal/wal/wal_test.go @@ -207,7 +207,7 @@ func TestWrite(t *testing.T) { numWrites := 20 wg.Add(numWrites) - for i := 0; i < numWrites; i++ { + for i := range numWrites { go func(i int) { defer wg.Done() err := tw.wal.Write(entry.Entry{ @@ -446,7 +446,7 @@ func TestSegmentRotation(t *testing.T) { numEntries := 5 written := make(map[string]bool) - for i := 0; i < numEntries; i++ { + for i := range numEntries { key := string(rune(i)) err := w.Write(entry.Entry{ Operation: entry.OperationSet,