chore: use errors.New to replace fmt.Errorf with no parameters (#32800)
use errors.New to replace fmt.Errorf with no parameters Signed-off-by: RiceChuan <lc582041246@gmail.com>
This commit is contained in:
parent
ee45950dab
commit
dfd7594499
@ -4,7 +4,7 @@
|
|||||||
package db // it's not db_test, because this file is for testing the private type halfCommitter
|
package db // it's not db_test, because this file is for testing the private type halfCommitter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -80,7 +80,7 @@ func Test_halfCommitter(t *testing.T) {
|
|||||||
testWithCommitter(mockCommitter, func(committer Committer) error {
|
testWithCommitter(mockCommitter, func(committer Committer) error {
|
||||||
defer committer.Close()
|
defer committer.Close()
|
||||||
if true {
|
if true {
|
||||||
return fmt.Errorf("error")
|
return errors.New("error")
|
||||||
}
|
}
|
||||||
return committer.Commit()
|
return committer.Commit()
|
||||||
})
|
})
|
||||||
@ -94,7 +94,7 @@ func Test_halfCommitter(t *testing.T) {
|
|||||||
testWithCommitter(mockCommitter, func(committer Committer) error {
|
testWithCommitter(mockCommitter, func(committer Committer) error {
|
||||||
committer.Close()
|
committer.Close()
|
||||||
committer.Commit()
|
committer.Commit()
|
||||||
return fmt.Errorf("error")
|
return errors.New("error")
|
||||||
})
|
})
|
||||||
|
|
||||||
mockCommitter.Assert(t)
|
mockCommitter.Assert(t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user