aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--brokenlinks/brokenlinks_test.go7
-rw-r--r--brokenlinks/options.go2
-rw-r--r--brokenlinks/worker.go10
-rw-r--r--cmd/jarink/main.go5
5 files changed, 6 insertions, 21 deletions
diff --git a/README.md b/README.md
index cbefa5a..4a9f50c 100644
--- a/README.md
+++ b/README.md
@@ -59,9 +59,6 @@ Scan only the pages reported by result from past scan based
on the content in JSON file.
This minimize the time to re-scan the pages once we have fixed the URLs.
-`-verbose`:
-Print the page that being scanned to standard error.
-
## EXAMPLES
Given a website that have the following pages,
diff --git a/brokenlinks/brokenlinks_test.go b/brokenlinks/brokenlinks_test.go
index a04be7f..eedad33 100644
--- a/brokenlinks/brokenlinks_test.go
+++ b/brokenlinks/brokenlinks_test.go
@@ -275,7 +275,6 @@ func TestScan(t *testing.T) {
Url: testUrl,
IgnoreStatus: `403`,
Insecure: true,
- IsVerbose: true,
},
exp: map[string][]jarink.Link{
testUrl: []jarink.Link{
@@ -362,8 +361,7 @@ func TestScan(t *testing.T) {
// pages other than below of "/page2" itself.
desc: `With Url=/page2`,
opts: brokenlinks.Options{
- Url: testUrl + `/page2`,
- IsVerbose: true,
+ Url: testUrl + `/page2`,
},
exp: map[string][]jarink.Link{
testUrl + `/page2`: []jarink.Link{
@@ -497,8 +495,7 @@ func TestScan_slow(t *testing.T) {
}
var opts = brokenlinks.Options{
- Url: testUrl,
- IsVerbose: true,
+ Url: testUrl,
}
gotResult, err := brokenlinks.Scan(opts)
if err != nil {
diff --git a/brokenlinks/options.go b/brokenlinks/options.go
index 2703f8d..e5f9fcf 100644
--- a/brokenlinks/options.go
+++ b/brokenlinks/options.go
@@ -27,8 +27,6 @@ type Options struct {
IgnoreStatus string
ignoreStatus []int
- IsVerbose bool
-
// Insecure do not report error on server with invalid certificates.
Insecure bool
}
diff --git a/brokenlinks/worker.go b/brokenlinks/worker.go
index 07bda88..a286362 100644
--- a/brokenlinks/worker.go
+++ b/brokenlinks/worker.go
@@ -139,6 +139,7 @@ func (wrk *worker) scanAll() (result *Result, err error) {
for x < len(wrk.queue) {
linkq = wrk.queue[x]
x++
+ wrk.log.Printf(`scan %d/%d: %s`, x, len(wrk.queue), linkq.Url)
resultq = wrk.scan(linkq)
wrk.processResult(resultq)
}
@@ -202,6 +203,7 @@ func (wrk *worker) processResult(resultq map[string]jarink.Link) {
continue
}
wrk.queue = append(wrk.queue, linkq)
+ wrk.log.Printf(`queue %d: %s`, len(wrk.queue), linkq.Url)
}
}
@@ -327,14 +329,10 @@ func (wrk *worker) fetch(linkq jarink.Link) (httpResp *http.Response, err error)
var retry int
for retry < 5 {
if linkq.Kind == int(atom.Img) {
- if wrk.opts.IsVerbose {
- wrk.log.Printf("fetch: HEAD %s", linkq.Url)
- }
+ wrk.log.Printf("fetch: HEAD %s", linkq.Url)
httpResp, err = wrk.httpc.Head(linkq.Url)
} else {
- if wrk.opts.IsVerbose {
- wrk.log.Printf("fetch: GET %s", linkq.Url)
- }
+ wrk.log.Printf("fetch: GET %s", linkq.Url)
httpResp, err = wrk.httpc.Get(linkq.Url)
}
if err == nil {
diff --git a/cmd/jarink/main.go b/cmd/jarink/main.go
index c2dc5b6..f7e225a 100644
--- a/cmd/jarink/main.go
+++ b/cmd/jarink/main.go
@@ -21,7 +21,6 @@ func main() {
var (
optIgnoreStatus string
optInsecure bool
- optIsVerbose bool
optPastResult string
)
@@ -31,9 +30,6 @@ func main() {
flag.BoolVar(&optInsecure, `insecure`, false,
`Do not report as error on server with invalid certificates.`)
- flag.BoolVar(&optIsVerbose, `verbose`, false,
- `Print additional information while running.`)
-
flag.StringVar(&optPastResult, `past-result`, ``,
`Scan only pages with broken links from the past JSON result.`)
@@ -46,7 +42,6 @@ func main() {
var opts = brokenlinks.Options{
IgnoreStatus: optIgnoreStatus,
Insecure: optInsecure,
- IsVerbose: optIsVerbose,
PastResultFile: optPastResult,
}