mirror of
https://github.com/securego/gosec.git
synced 2024-12-27 04:55:53 +00:00
21 lines
446 B
Go
21 lines
446 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"sort"
|
||
|
|
||
|
"github.com/GoASTScanner/gas"
|
||
|
)
|
||
|
|
||
|
type sortBySeverity []*gas.Issue
|
||
|
|
||
|
func (s sortBySeverity) Len() int { return len(s) }
|
||
|
|
||
|
func (s sortBySeverity) Less(i, j int) bool { return s[i].Severity > s[i].Severity }
|
||
|
|
||
|
func (s sortBySeverity) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||
|
|
||
|
// sortIssues sorts the issues by severity in descending order
|
||
|
func sortIssues(issues []*gas.Issue) {
|
||
|
sort.Sort(sortBySeverity(issues))
|
||
|
}
|