Skip to content

Commit

Permalink
sort dynamic opens on path
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <[email protected]>
  • Loading branch information
matthyx committed Oct 1, 2024
1 parent b8fd8f7 commit 48b1209
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/registry/file/dynamicpathdetector/analyze_opens.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dynamicpathdetector
import (
"maps"
"slices"
"strings"

mapset "github.com/deckarep/golang-set/v2"
types "github.com/kubescape/storage/pkg/apis/softwarecomposition"
Expand Down Expand Up @@ -33,7 +34,9 @@ func AnalyzeOpens(opens []types.OpenCalls, analyzer *PathAnalyzer) ([]types.Open
}
}

return slices.Collect(maps.Values(dynamicOpens)), nil
return slices.SortedFunc(maps.Values(dynamicOpens), func(a, b types.OpenCalls) int {
return strings.Compare(a.Path, b.Path)
}), nil
}

func AnalyzeOpen(path string, analyzer *PathAnalyzer) (string, error) {
Expand Down

0 comments on commit 48b1209

Please sign in to comment.