Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use errors.New to replace fmt.Errorf with no parameters will much better #4736

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion cluster/store/meta_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package store

import (
"errors"
"fmt"
"strings"
"sync"
Expand Down Expand Up @@ -88,7 +89,7 @@ func (m *metaClass) ShardOwner(shard string) (string, uint64, error) {
return "", 0, errShardNotFound
}
if len(x.BelongsToNodes) < 1 || x.BelongsToNodes[0] == "" {
return "", 0, fmt.Errorf("owner node not found")
return "", 0, errors.New("owner node not found")
}
return x.BelongsToNodes[0], m.version(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion cluster/transport/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (s *Service) Leader() string {
func (s *Service) Open() error {
s.log.Info("starting cloud rpc server ...", "address", s.address)
if s.address == "" {
return fmt.Errorf("address of rpc server cannot be empty")
return errors.New("address of rpc server cannot be empty")
}
ln, err := net.Listen("tcp", s.address)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion test/benchmark_bm25/cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package cmd

import (
"context"
"errors"
"fmt"
"log"
"strconv"
Expand Down Expand Up @@ -70,7 +71,7 @@ var importCmd = &cobra.Command{
}

if !ok {
return fmt.Errorf("weaviate is not ready")
return errors.New("weaviate is not ready")
}

datasets, err := lib.ParseDatasetConfig(DatasetConfigPath)
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark_bm25/cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var queryCmd = &cobra.Command{
}

if !ok {
return fmt.Errorf("weaviate is not ready")
return errors.New("weaviate is not ready")
}
log.Print("weaviate is ready")

Expand Down