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

change fmt.Errorf to errors.Errorf #361

Merged
merged 2 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/test/templates/option/function.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func {{ .TestName }}(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
go.uber.org/automaxprocs v1.3.0
go.uber.org/goleak v1.0.0
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9
golang.org/x/tools v0.0.0-20200501005904-d351ea090f9b // indirect
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d // indirect
gonum.org/v1/hdf5 v0.0.0-20191105085658-fe04b73f3b53
gonum.org/v1/netlib v0.0.0-20200317120129-c5a04cffd98a // indirect
gonum.org/v1/plot v0.7.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191203134012-c197fd4bf371/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200501005904-d351ea090f9b h1:2hSR2MyOaYEy6yJYg/CpErymr/m7xJEJpm9kfT7ZMg4=
golang.org/x/tools v0.0.0-20200501005904-d351ea090f9b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d h1:lzLdP95xJmMpwQ6LUHwrc5V7js93hTiY7gkznu0BgmY=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
Expand Down
4 changes: 2 additions & 2 deletions hack/benchmark/core/benchmark/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestWithStrategy(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
16 changes: 8 additions & 8 deletions hack/benchmark/core/benchmark/strategy/strategy_option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestWithPreProp32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestWithProp32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestWithPreProp64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -404,7 +404,7 @@ func TestWithProp64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -517,7 +517,7 @@ func TestWithPropName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -630,7 +630,7 @@ func TestWithCore32(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -743,7 +743,7 @@ func TestWithCore64(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -852,7 +852,7 @@ func TestWithParallel(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions hack/benchmark/internal/assets/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package assets

import (
"fmt"
"strconv"

"github.com/kpango/fuid"
"github.com/vdaas/vald/internal/errors"
"github.com/vdaas/vald/internal/log"
"gonum.org/v1/hdf5"
)
Expand Down Expand Up @@ -103,7 +103,7 @@ func Load(path string) (train, test, distances [][]float32, neighbors [][]int, d
}
test = v2.([][]float32)
if dim != testDim {
return train, test, nil, nil, 0, fmt.Errorf("test has different dimension from train")
return train, test, nil, nil, 0, errors.Errorf("test has different dimension from train")
}
distancesDim, v3, err := loadDataset(f, "distances", loadFloat32)
if err != nil {
Expand All @@ -119,7 +119,7 @@ func Load(path string) (train, test, distances [][]float32, neighbors [][]int, d
}
neighbors = v4.([][]int)
if distancesDim != neighborsDim {
return train, test, distances, neighbors, dim, fmt.Errorf("neighbors has different dimension from distances")
return train, test, distances, neighbors, dim, errors.Errorf("neighbors has different dimension from distances")
}

return train, test, distances, neighbors, dim, nil
Expand Down
4 changes: 2 additions & 2 deletions hack/benchmark/internal/client/ngtd/grpc/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestWithAddr(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestWithGRPCClientOption(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/internal/client/ngtd/rest/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithAddr(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions hack/benchmark/internal/core/gongt/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithIndexPath(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestWithObjectType(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestWithDimension(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions hack/benchmark/internal/core/ngt/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithIndexPath(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestWithObjectType(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestWithDimension(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions hack/benchmark/internal/e2e/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestWithName(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestWithClient(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestWithStrategy(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -404,7 +404,7 @@ func TestWithServerStarter(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestWithCreateIndexPoolSize(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestWithCreateIndexClient(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/internal/e2e/strategy/insert_option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithParallelInsert(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/benchmark/internal/e2e/strategy/remove_option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithParallelRemove(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions hack/benchmark/internal/e2e/strategy/search_option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestWithSearchParallel(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestWithSearchConfig(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestWithStreamSearchConfig(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions hack/benchmark/internal/starter/agent/ngt/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestWithConfig(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestWithDimentaion(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -289,7 +289,7 @@ func TestWithDistanceType(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -402,7 +402,7 @@ func TestWithObjectType(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions hack/benchmark/internal/starter/external/ngtd/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestWithDimentaion(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestWithServerType(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestWithIndexDir(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down Expand Up @@ -400,7 +400,7 @@ func TestWithPort(t *testing.T) {
/*
defaultCheckFunc := func(w want, obj *T) error {
if !reflect.DeepEqual(obj, w.obj) {
return fmt.Errorf("got = %v, want %v", obj, w.c)
return errors.Errorf("got = %v, want %v", obj, w.c)
}
return nil
}
Expand Down
Loading