From c70432cf259870ed0f1dc0fd64dd490206e58dca Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 08:58:06 +0000 Subject: [PATCH] style: format code with Gofumpt and Prettier This commit fixes the style issues introduced in 6a6a2a5 according to the output from Gofumpt and Prettier. Details: https://github.com/vdaas/vald/pull/1771 --- internal/net/dialer.go | 14 +++++++------- internal/net/grpc/option.go | 16 ++++++++-------- internal/servers/servers.go | 16 ++++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/internal/net/dialer.go b/internal/net/dialer.go index 3eb9bb7c401..67e23cf7029 100644 --- a/internal/net/dialer.go +++ b/internal/net/dialer.go @@ -324,14 +324,14 @@ func (d *dialer) dial(ctx context.Context, network, addr string) (conn Conn, err }() log.Debugf("%s connection dialing to addr %s", network, addr) err = safety.RecoverWithoutPanicFunc(func() (err error) { - if IsUDP(network) { - conn, err = quic.DialContext(ctx, addr, d.tlsConfig) - } else { - conn, err = d.npDialer.DialConnection(network, addr, d.der.Timeout) - if err != nil { - conn, err = d.der.DialContext(ctx, network, addr) + if IsUDP(network) { + conn, err = quic.DialContext(ctx, addr, d.tlsConfig) + } else { + conn, err = d.npDialer.DialConnection(network, addr, d.der.Timeout) + if err != nil { + conn, err = d.der.DialContext(ctx, network, addr) + } } - } return err })() if err != nil { diff --git a/internal/net/grpc/option.go b/internal/net/grpc/option.go index 8ffb4958580..26dee5da124 100644 --- a/internal/net/grpc/option.go +++ b/internal/net/grpc/option.go @@ -493,14 +493,14 @@ func WithDialer(network string, der net.Dialer) Option { g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength) } nt := net.NetworkTypeFromString(network) - switch nt { - case net.UDP, net.UDP4, net.UDP6: - nt = net.UDP - case net.UNIX, net.UNIXGRAM, net.UNIXPACKET: - nt = net.UNIX - default: - nt = net.TCP - } + switch nt { + case net.UDP, net.UDP4, net.UDP6: + nt = net.UDP + case net.UNIX, net.UNIXGRAM, net.UNIXPACKET: + nt = net.UNIX + default: + nt = net.TCP + } g.dopts = append(g.dopts, grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) { log.Debugf("gRPC context Dialer for network %s, addr is %s", nt.String(), addr) diff --git a/internal/servers/servers.go b/internal/servers/servers.go index fed0c8a84a4..467fe51bf6d 100644 --- a/internal/servers/servers.go +++ b/internal/servers/servers.go @@ -73,10 +73,10 @@ func (l *listener) ListenAndServe(ctx context.Context) <-chan error { if !l.servers[name].IsRunning() { err := l.servers[name].ListenAndServe(ctx, ech) if err != nil { - select { - case <-ctx.Done(): - case ech <- err: - } + select { + case <-ctx.Done(): + case ech <- err: + } } } } @@ -85,10 +85,10 @@ func (l *listener) ListenAndServe(ctx context.Context) <-chan error { if !l.servers[name].IsRunning() { err := l.servers[name].ListenAndServe(ctx, ech) if err != nil { - select { - case <-ctx.Done(): - case ech <- err: - } + select { + case <-ctx.Done(): + case ech <- err: + } } } }