summaryrefslogtreecommitdiff
path: root/result.go
diff options
context:
space:
mode:
Diffstat (limited to 'result.go')
-rw-r--r--result.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/result.go b/result.go
index a66114f..1fc11c5 100644
--- a/result.go
+++ b/result.go
@@ -3,6 +3,11 @@
package deadlinks
+import (
+ "slices"
+ "strings"
+)
+
// Broken store the link with its HTTP status.
type Broken struct {
Link string
@@ -20,3 +25,11 @@ func newResult() *Result {
PageLinks: map[string][]Broken{},
}
}
+
+func (result *Result) sort() {
+ for _, listBroken := range result.PageLinks {
+ slices.SortFunc(listBroken, func(a, b Broken) int {
+ return strings.Compare(a.Link, b.Link)
+ })
+ }
+}