Skip to content

Commit 73b21dd

Browse files
authored
chore: use errors.New to replace fmt.Errorf with no parameters (#1015)
Signed-off-by: RiceChuan <lc582041246@gmail.com>
1 parent 456159f commit 73b21dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

nodedb.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (ndb *nodeDB) GetFastNode(key []byte) (*fastnode.Node, error) {
204204
defer ndb.mtx.Unlock()
205205

206206
if len(key) == 0 {
207-
return nil, fmt.Errorf("nodeDB.GetFastNode() requires key, len(key) equals 0")
207+
return nil, errors.New("nodeDB.GetFastNode() requires key, len(key) equals 0")
208208
}
209209

210210
if cachedFastNode := ndb.fastNodeCache.Get(key); cachedFastNode != nil {
@@ -1338,4 +1338,4 @@ func (ndb *nodeDB) String() (string, error) {
13381338
return "-" + "\n" + buf.String() + "-", nil
13391339
}
13401340

1341-
var ErrNodeMissingNodeKey = fmt.Errorf("node does not have a nodeKey")
1341+
var ErrNodeMissingNodeKey = errors.New("node does not have a nodeKey")

nodedb_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func TestTraverseNodes(t *testing.T) {
278278
return err
279279
}
280280
if actualNode.String() != node.String() {
281-
return fmt.Errorf("found unexpected node")
281+
return errors.New("found unexpected node")
282282
}
283283
count++
284284
return nil

0 commit comments

Comments
 (0)