Skip to content

Commit

Permalink
chore: use errors.New to replace fmt.Errorf with no parameters (#1015)
Browse files Browse the repository at this point in the history
Signed-off-by: RiceChuan <lc582041246@gmail.com>
  • Loading branch information
RiceChuan authored Dec 12, 2024
1 parent 456159f commit 73b21dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (ndb *nodeDB) GetFastNode(key []byte) (*fastnode.Node, error) {
defer ndb.mtx.Unlock()

if len(key) == 0 {
return nil, fmt.Errorf("nodeDB.GetFastNode() requires key, len(key) equals 0")
return nil, errors.New("nodeDB.GetFastNode() requires key, len(key) equals 0")
}

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

var ErrNodeMissingNodeKey = fmt.Errorf("node does not have a nodeKey")
var ErrNodeMissingNodeKey = errors.New("node does not have a nodeKey")
2 changes: 1 addition & 1 deletion nodedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func TestTraverseNodes(t *testing.T) {
return err
}
if actualNode.String() != node.String() {
return fmt.Errorf("found unexpected node")
return errors.New("found unexpected node")
}
count++
return nil
Expand Down

0 comments on commit 73b21dd

Please sign in to comment.