aboutsummaryrefslogtreecommitdiff
path: root/brokenlinks/result.go
diff options
context:
space:
mode:
Diffstat (limited to 'brokenlinks/result.go')
-rw-r--r--brokenlinks/result.go20
1 files changed, 7 insertions, 13 deletions
diff --git a/brokenlinks/result.go b/brokenlinks/result.go
index 676859b..1cd49a3 100644
--- a/brokenlinks/result.go
+++ b/brokenlinks/result.go
@@ -1,37 +1,31 @@
-// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
// SPDX-License-Identifier: GPL-3.0-only
+// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
package brokenlinks
import (
"slices"
"strings"
-)
-// Broken store the broken link, HTTP status code, and the error message that
-// cause it.
-type Broken struct {
- Link string `json:"link"`
- Error string `json:"error,omitempty"`
- Code int `json:"code"`
-}
+ "git.sr.ht/~shulhan/jarink"
+)
// Result store the result of scanning for broken links.
type Result struct {
// BrokenLinks store the page and its broken links.
- BrokenLinks map[string][]Broken `json:"broken_links"`
+ BrokenLinks map[string][]jarink.Link `json:"broken_links"`
}
func newResult() *Result {
return &Result{
- BrokenLinks: map[string][]Broken{},
+ BrokenLinks: map[string][]jarink.Link{},
}
}
func (result *Result) sort() {
for _, listBroken := range result.BrokenLinks {
- slices.SortFunc(listBroken, func(a, b Broken) int {
- return strings.Compare(a.Link, b.Link)
+ slices.SortFunc(listBroken, func(a, b jarink.Link) int {
+ return strings.Compare(a.Url, b.Url)
})
}
}