test: Fix gosimple errors
Getting gosimple suggestion while running test script, so this PR is for fixing gosimple S1019 check. raft/node_test.go:456:40: should use make([]raftpb.Entry, 1) instead (S1019) raft/node_test.go:457:49: should use make([]raftpb.Entry, 1) instead (S1019) raft/node_test.go:458:43: should use make([]raftpb.Message, 1) instead (S1019) Refer https://github.com/dominikh/go-tools/blob/master/cmd/gosimple/README.md#checks for more information.
This commit is contained in:
@ -87,7 +87,7 @@ type notifier struct {
|
|||||||
|
|
||||||
func newNotifier() *notifier {
|
func newNotifier() *notifier {
|
||||||
return ¬ifier{
|
return ¬ifier{
|
||||||
c: make(chan struct{}, 0),
|
c: make(chan struct{}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ func TestElectionFailover(t *testing.T) {
|
|||||||
cctx, cancel := context.WithCancel(context.TODO())
|
cctx, cancel := context.WithCancel(context.TODO())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
ss := make([]*concurrency.Session, 3, 3)
|
ss := make([]*concurrency.Session, 3)
|
||||||
|
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
var err error
|
var err error
|
||||||
|
@ -101,7 +101,7 @@ func NewStore(b backend.Backend, le lease.Lessor, ig ConsistentIndexGetter) *sto
|
|||||||
currentRev: revision{main: 1},
|
currentRev: revision{main: 1},
|
||||||
compactMainRev: -1,
|
compactMainRev: -1,
|
||||||
|
|
||||||
bytesBuf8: make([]byte, 8, 8),
|
bytesBuf8: make([]byte, 8),
|
||||||
fifoSched: schedule.NewFIFOScheduler(),
|
fifoSched: schedule.NewFIFOScheduler(),
|
||||||
|
|
||||||
stopc: make(chan struct{}),
|
stopc: make(chan struct{}),
|
||||||
|
@ -453,9 +453,9 @@ func TestReadyContainUpdates(t *testing.T) {
|
|||||||
{Ready{}, false},
|
{Ready{}, false},
|
||||||
{Ready{SoftState: &SoftState{Lead: 1}}, true},
|
{Ready{SoftState: &SoftState{Lead: 1}}, true},
|
||||||
{Ready{HardState: raftpb.HardState{Vote: 1}}, true},
|
{Ready{HardState: raftpb.HardState{Vote: 1}}, true},
|
||||||
{Ready{Entries: make([]raftpb.Entry, 1, 1)}, true},
|
{Ready{Entries: make([]raftpb.Entry, 1)}, true},
|
||||||
{Ready{CommittedEntries: make([]raftpb.Entry, 1, 1)}, true},
|
{Ready{CommittedEntries: make([]raftpb.Entry, 1)}, true},
|
||||||
{Ready{Messages: make([]raftpb.Message, 1, 1)}, true},
|
{Ready{Messages: make([]raftpb.Message, 1)}, true},
|
||||||
{Ready{Snapshot: raftpb.Snapshot{Metadata: raftpb.SnapshotMetadata{Index: 1}}}, true},
|
{Ready{Snapshot: raftpb.Snapshot{Metadata: raftpb.SnapshotMetadata{Index: 1}}}, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ func doRounds(rcs []roundClient, rounds int) {
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
wg.Add(len(rcs))
|
wg.Add(len(rcs))
|
||||||
finished := make(chan struct{}, 0)
|
finished := make(chan struct{})
|
||||||
for i := range rcs {
|
for i := range rcs {
|
||||||
go func(rc *roundClient) {
|
go func(rc *roundClient) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
Reference in New Issue
Block a user