From f3b3c35b0c784e6924f30f8d2626b25cdc38a69c Mon Sep 17 00:00:00 2001 From: datadog-bits-staging <264369727+datadog-bits-staging@users.noreply.github.com> Date: Mon, 9 Mar 2026 09:25:44 +0000 Subject: [PATCH] Use strings.Compare in readDir sort Co-authored-by: AlexandreYang <49917914+AlexandreYang@users.noreply.github.com> --- interp/allowed_paths.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/interp/allowed_paths.go b/interp/allowed_paths.go index 286e2297..95bf96f4 100644 --- a/interp/allowed_paths.go +++ b/interp/allowed_paths.go @@ -129,13 +129,7 @@ func (s *pathSandbox) readDir(ctx context.Context, path string) ([]fs.DirEntry, // os.Root's ReadDir does not guarantee sorted order like os.ReadDir. // Sort to match POSIX glob expansion expectations. slices.SortFunc(entries, func(a, b fs.DirEntry) int { - if a.Name() < b.Name() { - return -1 - } - if a.Name() > b.Name() { - return 1 - } - return 0 + return strings.Compare(a.Name(), b.Name()) }) return entries, nil }