diff options
| -rw-r--r-- | brokenlinks.go | 2 | ||||
| -rw-r--r-- | brokenlinks_worker.go | 2 | ||||
| -rw-r--r-- | cmd/jarink/main.go | 2 | ||||
| -rw-r--r-- | testdata/past_result.json | 14 |
4 files changed, 11 insertions, 9 deletions
diff --git a/brokenlinks.go b/brokenlinks.go index 833e2d2..4be4fe8 100644 --- a/brokenlinks.go +++ b/brokenlinks.go @@ -33,7 +33,7 @@ type BrokenlinksOptions struct { // BrokenlinksResult store the result of scanning for broken links. type BrokenlinksResult struct { // PageLinks store the page and its broken links. - PageLinks map[string][]Broken + PageLinks map[string][]Broken `json:"page_links"` } func newBrokenlinksResult() *BrokenlinksResult { diff --git a/brokenlinks_worker.go b/brokenlinks_worker.go index dbb3453..03a89bd 100644 --- a/brokenlinks_worker.go +++ b/brokenlinks_worker.go @@ -82,7 +82,7 @@ func newWorker(opts BrokenlinksOptions) (wrk *brokenlinksWorker, err error) { } wrk.pastResult = newBrokenlinksResult() - err = json.Unmarshal(pastresult, &wrk.pastResult.PageLinks) + err = json.Unmarshal(pastresult, &wrk.pastResult) if err != nil { return nil, err } diff --git a/cmd/jarink/main.go b/cmd/jarink/main.go index c8ba2e2..cba254f 100644 --- a/cmd/jarink/main.go +++ b/cmd/jarink/main.go @@ -45,7 +45,7 @@ func main() { } var resultJson []byte - resultJson, err = json.MarshalIndent(result.PageLinks, ``, ` `) + resultJson, err = json.MarshalIndent(result, ``, ` `) if err != nil { log.Fatal(err.Error()) } diff --git a/testdata/past_result.json b/testdata/past_result.json index 3ba37c1..a5a11fe 100644 --- a/testdata/past_result.json +++ b/testdata/past_result.json @@ -1,8 +1,10 @@ { - "http://127.0.0.1:11836/page2": [ - { - "link": "http://127.0.0.1:11836/", - "code": 404 - } - ] + "page_links": { + "http://127.0.0.1:11836/page2": [ + { + "link": "http://127.0.0.1:11836/", + "code": 404 + } + ] + } } |
