feat: enable unparam lint

Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
Wei Fu
2023-09-18 20:22:21 +08:00
parent be83fffedb
commit aea1cd0077
43 changed files with 122 additions and 141 deletions

View File

@ -50,11 +50,11 @@ func ExampleSTM_apply() {
}
}
exchange := func(stm concurrency.STM) error {
exchange := func(stm concurrency.STM) {
from, to := rand.Intn(totalAccounts), rand.Intn(totalAccounts)
if from == to {
// nothing to do
return nil
return
}
// read values
fromK, toK := fmt.Sprintf("accts/%d", from), fmt.Sprintf("accts/%d", to)
@ -70,7 +70,7 @@ func ExampleSTM_apply() {
// write back
stm.Put(fromK, fmt.Sprintf("%d", fromInt))
stm.Put(toK, fmt.Sprintf("%d", toInt))
return nil
return
}
// concurrently exchange values between accounts
@ -79,7 +79,10 @@ func ExampleSTM_apply() {
for i := 0; i < 10; i++ {
go func() {
defer wg.Done()
if _, serr := concurrency.NewSTM(cli, exchange); serr != nil {
if _, serr := concurrency.NewSTM(cli, func(stm concurrency.STM) error {
exchange(stm)
return nil
}); serr != nil {
log.Fatal(serr)
}
}()