Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func TestNew_SecondJoiner(t *testing.T) {
func TestNew_ThirdJoiner(t *testing.T) {
apps := []*app.App{}

for i := 0; i < 4; i++ {
for i := range 4 {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestNew_ThirdJoiner(t *testing.T) {
func TestNew_FourthJoiner(t *testing.T) {
apps := []*app.App{}

for i := 0; i < 5; i++ {
for i := range 5 {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestNew_FourthJoiner(t *testing.T) {
func TestNew_FifthJoiner(t *testing.T) {
apps := []*app.App{}

for i := 0; i < 6; i++ {
for i := range 6 {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -274,7 +274,7 @@ func TestNew_FifthJoiner(t *testing.T) {
func TestNew_SixthJoiner(t *testing.T) {
apps := []*app.App{}

for i := 0; i < 7; i++ {
for i := range 7 {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -311,7 +311,7 @@ func TestHandover_Voter(t *testing.T) {
n := 4
apps := make([]*app.App, n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -355,7 +355,7 @@ func TestHandover_TwoNodes(t *testing.T) {
n := 2
apps := make([]*app.App, n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestHandover_VoterHonorFailureDomain(t *testing.T) {
n := 6
apps := make([]*app.App, n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -447,7 +447,7 @@ func TestHandover_GracefulShutdown(t *testing.T) {
n := 3
apps := make([]*app.App, n)

for i := 0; i < n; i++ {
for i := range n {
dir, cleanup := newDir(t)
defer cleanup()

Expand Down Expand Up @@ -490,7 +490,7 @@ func TestHandover_StandBy(t *testing.T) {
n := 7
apps := make([]*app.App, n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -539,7 +539,7 @@ func TestHandover_TransferLeadership(t *testing.T) {
n := 4
apps := make([]*app.App, n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{app.WithAddress(addr)}
if i > 0 {
Expand Down Expand Up @@ -589,7 +589,7 @@ func TestRolesAdjustment_ReplaceVoter(t *testing.T) {
apps := make([]*app.App, n)
cleanups := make([]func(), n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -637,7 +637,7 @@ func TestRolesAdjustment_ReplaceVoterHonorFailureDomain(t *testing.T) {
apps := make([]*app.App, n)
cleanups := make([]func(), n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -690,7 +690,7 @@ func TestRolesAdjustment_ReplaceVoterHonorWeight(t *testing.T) {
apps := make([]*app.App, n)
cleanups := make([]func(), n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -757,7 +757,7 @@ func TestRolesAdjustment_CantReplaceVoter(t *testing.T) {
apps := make([]*app.App, n)
cleanups := make([]func(), n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -803,7 +803,7 @@ func TestRolesAdjustment_ReplaceStandBy(t *testing.T) {
apps := make([]*app.App, n)
cleanups := make([]func(), n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -857,7 +857,7 @@ func TestRolesAdjustment_ReplaceStandByHonorFailureDomains(t *testing.T) {
apps := make([]*app.App, n)
cleanups := make([]func(), n)

for i := 0; i < n; i++ {
for i := range n {
addr := fmt.Sprintf("127.0.0.1:900%d", i+1)
options := []app.Option{
app.WithAddress(addr),
Expand Down Expand Up @@ -1138,7 +1138,7 @@ func TestExternalConnWithPipe(t *testing.T) {

func TestParallelNewApp(t *testing.T) {
t.Parallel()
for i := 0; i < 100; i++ {
for i := range 100 {
i := i
t.Run(fmt.Sprintf("run-%d", i), func(tt *testing.T) {
tt.Parallel()
Expand Down
3 changes: 2 additions & 1 deletion app/roles.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"slices"
"sort"

"github.com/cowsql/go-cowsql/client"
Expand Down Expand Up @@ -97,7 +98,7 @@ func (c *RolesChanges) Handover(id uint64) (client.NodeRole, []client.NodeInfo)
peers := c.list(node.Role, true)
for i := range peers {
if peers[i].ID == node.ID {
peers = append(peers[:i], peers[i+1:]...)
peers = slices.Delete(peers, i, i+1)
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion driver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestIntegration_LargeQuery(t *testing.T) {
stmt, err := tx.Prepare("INSERT INTO test(n) VALUES(?)")
requireNoError(t, err)

for i := 0; i < 512; i++ {
for i := range 512 {
_, err = stmt.Exec(int64(i))
requireNoError(t, err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/protocol/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (m *Message) reset() {
m.mtype = 0
m.schema = 0
m.extra = 0
for i := 0; i < messageHeaderSize; i++ {
for i := range messageHeaderSize {
m.header[i] = 0
}
m.body.Offset = 0
Expand Down Expand Up @@ -494,7 +494,7 @@ func (r *Rows) columnTypes(save bool) ([]uint8, error) {

headerSize := (headerBits + padBits) / messageWordBits * messageWordSize

for i := 0; i < headerSize; i++ {
for i := range headerSize {
slot := r.message.getUint8()

if slot == 0xee {
Expand Down