Skip to content

Commit

Permalink
style: format code with Gofumpt and Prettier
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 0188da9 according to the output
from Gofumpt and Prettier.

Details: #2505
Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
deepsource-autofix[bot] authored and kpango committed Jul 15, 2024
1 parent 0188da9 commit f718c39
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Makefile.d/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ binary/build: \
cmd/agent/core/ngt/ngt: \
ngt/install
$(eval CGO_ENABLED = 1)
$(call go-build,agent/core/ngt,-linkmode 'external',-static -fPIC -pthread -fopenmp -std=gnu++20 -lstdc++ -lm -z relro -z now -flto -march=native -fno-plt -Wl,-Ofast,--sort-common,--as-needed -ffunction-sections -Wl,--gc-sections -fvisibility=hidden -ffp-contract=fast $(EXTLDFLAGS), cgo,NGT-$(NGT_VERSION),$@)
$(call go-build,agent/core/ngt,-linkmode 'external',-static -fPIC -pthread -fopenmp -std=gnu++20 -lstdc++ -lm -z relro -z now -flto -march=native -fno-plt -Wl,-Ofast,--sort-common,--as-needed -Wl,--gc-sections -fvisibility=hidden -ffp-contract=fast $(EXTLDFLAGS), cgo,NGT-$(NGT_VERSION),$@)

cmd/agent/core/faiss/faiss: \
faiss/install
Expand Down
63 changes: 33 additions & 30 deletions apis/grpc/v1/vald/vald.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ package vald
import grpc "google.golang.org/grpc"

type Server interface {
FlushServer
IndexServer
InsertServer
ObjectServer
RemoveServer
SearchServer
UpdateServer
UpsertServer
SearchServer
RemoveServer
FlushServer
ObjectServer
}

type ServerWithFilter interface {
Expand All @@ -35,13 +36,14 @@ type ServerWithFilter interface {
}

type UnimplementedValdServer struct {
UnimplementedFlushServer
UnimplementedIndexServer
UnimplementedInsertServer
UnimplementedObjectServer
UnimplementedRemoveServer
UnimplementedSearchServer
UnimplementedUpdateServer
UnimplementedUpsertServer
UnimplementedSearchServer
UnimplementedRemoveServer
UnimplementedFlushServer
UnimplementedObjectServer
}

type UnimplementedValdServerWithFilter struct {
Expand All @@ -50,13 +52,14 @@ type UnimplementedValdServerWithFilter struct {
}

type Client interface {
FlushClient
IndexClient
InsertClient
ObjectClient
RemoveClient
SearchClient
UpdateClient
UpsertClient
SearchClient
RemoveClient
FlushClient
ObjectClient
}

type ClientWithFilter interface {
Expand Down Expand Up @@ -137,25 +140,25 @@ const (
)

type client struct {
FlushClient
IndexClient
InsertClient
ObjectClient
RemoveClient
SearchClient
UpdateClient
UpsertClient
SearchClient
RemoveClient
FlushClient
ObjectClient
IndexClient
}

func RegisterValdServer(s *grpc.Server, srv Server) {
RegisterFlushServer(s, srv)
RegisterIndexServer(s, srv)
RegisterInsertServer(s, srv)
RegisterObjectServer(s, srv)
RegisterRemoveServer(s, srv)
RegisterSearchServer(s, srv)
RegisterUpdateServer(s, srv)
RegisterUpsertServer(s, srv)
RegisterSearchServer(s, srv)
RegisterRemoveServer(s, srv)
RegisterFlushServer(s, srv)
RegisterObjectServer(s, srv)
RegisterIndexServer(s, srv)
}

func RegisterValdServerWithFilter(s *grpc.Server, srv ServerWithFilter) {
Expand All @@ -165,13 +168,13 @@ func RegisterValdServerWithFilter(s *grpc.Server, srv ServerWithFilter) {

func NewValdClient(conn *grpc.ClientConn) Client {
return &client{
NewInsertClient(conn),
NewUpdateClient(conn),
NewUpsertClient(conn),
NewSearchClient(conn),
NewRemoveClient(conn),
NewFlushClient(conn),
NewObjectClient(conn),
NewIndexClient(conn),
FlushClient: NewFlushClient(conn),
IndexClient: NewIndexClient(conn),
InsertClient: NewInsertClient(conn),
ObjectClient: NewObjectClient(conn),
RemoveClient: NewRemoveClient(conn),
SearchClient: NewSearchClient(conn),
UpdateClient: NewUpdateClient(conn),
UpsertClient: NewUpsertClient(conn),
}
}
6 changes: 6 additions & 0 deletions internal/core/algorithm/faiss/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
// Package faiss provides implementation of Go API for https://github.com/facebookresearch/faiss
package faiss

/*
#cgo LDFLAGS: -lfaiss
#include <Capi.h>
*/
import "C"

import (
"strings"

Expand Down
3 changes: 2 additions & 1 deletion pkg/manager/index/service/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"time"

agent "github.com/vdaas/vald/apis/grpc/v1/agent/core"
vald "github.com/vdaas/vald/apis/grpc/v1/vald"
"github.com/vdaas/vald/apis/grpc/v1/payload"
"github.com/vdaas/vald/internal/client/v1/client/discoverer"
"github.com/vdaas/vald/internal/errors"
Expand Down Expand Up @@ -305,7 +306,7 @@ func (idx *index) loadInfos(ctx context.Context) (err error) {
case <-ctx.Done():
return nil
default:
info, err := agent.NewAgentClient(conn).IndexInfo(ctx, new(payload.Empty), copts...)
info, err := vald.NewValdClient(conn).IndexInfo(ctx, new(payload.Empty), copts...)
if err != nil {
log.Warnf("an error occurred while calling IndexInfo of %s: %s", addr, err)
return nil
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/kubernetes/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ func (cli *client) Portforward(
}

func (cli *client) GetPod(ctx context.Context, namespace,
name string) (*corev1.Pod, error) {
name string,
) (*corev1.Pod, error) {
pod, err := cli.clientset.CoreV1().Pods(
namespace,
).Get(ctx, name, metav1.GetOptions{})
Expand Down

0 comments on commit f718c39

Please sign in to comment.