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 6a6a2a5 according to the output
from Gofumpt and Prettier.

Details: #1771
  • Loading branch information
deepsource-autofix[bot] authored Oct 24, 2024
1 parent 6a6a2a5 commit c70432c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
14 changes: 7 additions & 7 deletions internal/net/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions internal/net/grpc/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions internal/servers/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
}
}
}
}
Expand All @@ -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:
}
}
}
}
Expand Down

0 comments on commit c70432c

Please sign in to comment.