From f6a1e123fc646f4d804cf3d5039b3d36f25cef3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 19 Aug 2024 11:14:38 +0800 Subject: [PATCH] Make linter happy --- experimental/libbox/dns.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/experimental/libbox/dns.go b/experimental/libbox/dns.go index e1f8bcc3..a46d9b42 100644 --- a/experimental/libbox/dns.go +++ b/experimental/libbox/dns.go @@ -69,7 +69,8 @@ func (p *platformLocalDNSTransport) Exchange(ctx context.Context, message *mDNS. context: ctx, } var responseMessage *mDNS.Msg - return responseMessage, task.Run(ctx, func() error { + var group task.Group + group.Append0(func(ctx context.Context) error { err = p.iif.Exchange(response, messageBytes) if err != nil { return err @@ -80,6 +81,11 @@ func (p *platformLocalDNSTransport) Exchange(ctx context.Context, message *mDNS. responseMessage = &response.message return nil }) + err = group.Run(ctx) + if err != nil { + return nil, err + } + return responseMessage, nil } func (p *platformLocalDNSTransport) Lookup(ctx context.Context, domain string, strategy dns.DomainStrategy) ([]netip.Addr, error) { @@ -96,7 +102,8 @@ func (p *platformLocalDNSTransport) Lookup(ctx context.Context, domain string, s context: ctx, } var responseAddr []netip.Addr - return responseAddr, task.Run(ctx, func() error { + var group task.Group + group.Append0(func(ctx context.Context) error { err := p.iif.Lookup(response, network, domain) if err != nil { return err @@ -121,6 +128,11 @@ func (p *platformLocalDNSTransport) Lookup(ctx context.Context, domain string, s }*/ return nil }) + err := group.Run(ctx) + if err != nil { + return nil, err + } + return responseAddr, nil } type Func interface {