From a2b2e60082982c272b8c9bb9896ff13022fe914a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 31 Mar 2026 15:53:30 +0800 Subject: [PATCH] dns: fix test style issues in repro_test.go - Rename addrs to addresses per naming conventions - Replace errors.New with E.New per error-handling rules --- dns/repro_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dns/repro_test.go b/dns/repro_test.go index 8455b088c..113f7c49b 100644 --- a/dns/repro_test.go +++ b/dns/repro_test.go @@ -2,13 +2,13 @@ package dns import ( "context" - "errors" "net/netip" "testing" "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/option" + E "github.com/sagernet/sing/common/exceptions" "github.com/sagernet/sing/common/json/badoption" mDNS "github.com/miekg/dns" @@ -35,12 +35,12 @@ func TestReproLookupWithRulesUsesRequestStrategy(t *testing.T) { }, }) - addrs, err := router.Lookup(context.Background(), "example.com", adapter.DNSQueryOptions{ + addresses, err := router.Lookup(context.Background(), "example.com", adapter.DNSQueryOptions{ Strategy: C.DomainStrategyIPv4Only, }) require.NoError(t, err) require.Equal(t, []uint16{mDNS.TypeA}, qTypes) - require.Equal(t, []netip.Addr{netip.MustParseAddr("2.2.2.2")}, addrs) + require.Equal(t, []netip.Addr{netip.MustParseAddr("2.2.2.2")}, addresses) } func TestReproLogicalMatchResponseIPCIDR(t *testing.T) { @@ -62,7 +62,7 @@ func TestReproLogicalMatchResponseIPCIDR(t *testing.T) { case "selected": return FixedResponse(0, message.Question[0], []netip.Addr{netip.MustParseAddr("8.8.8.8")}, 60), nil default: - return nil, errors.New("unexpected transport") + return nil, E.New("unexpected transport") } }, }