From a0d8e374fb5d8701aa63ab4679f7467464f467f8 Mon Sep 17 00:00:00 2001 From: XYenon Date: Sun, 30 Apr 2023 16:58:07 +0800 Subject: [PATCH] Fix incorrect use of sort.Slice --- experimental/clashapi/proxies.go | 2 +- outbound/urltest.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/experimental/clashapi/proxies.go b/experimental/clashapi/proxies.go index bdc97436..4ea62749 100644 --- a/experimental/clashapi/proxies.go +++ b/experimental/clashapi/proxies.go @@ -133,7 +133,7 @@ func getProxies(server *Server, router adapter.Router) func(w http.ResponseWrite defaultTag = allProxies[0] } - sort.Slice(allProxies, func(i, j int) bool { + sort.SliceStable(allProxies, func(i, j int) bool { return allProxies[i] == defaultTag }) diff --git a/outbound/urltest.go b/outbound/urltest.go index eca5568b..cfb59c82 100644 --- a/outbound/urltest.go +++ b/outbound/urltest.go @@ -220,7 +220,7 @@ func (g *URLTestGroup) Fallback(used adapter.Outbound) []adapter.Outbound { outbounds = append(outbounds, detour) } } - sort.Slice(outbounds, func(i, j int) bool { + sort.SliceStable(outbounds, func(i, j int) bool { oi := outbounds[i] oj := outbounds[j] hi := g.history.LoadURLTestHistory(RealTag(oi))