summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go
index f663005..4cb3d0d 100644
--- a/main.go
+++ b/main.go
@@ -24,6 +24,8 @@ func main() {
flag.Parse()
+ // Vet the given CLI arguments for things like negative or
+ // missing values.
if *maxConcurrency == 0 {
log.Fatal("Missing -c argument")
}
@@ -44,6 +46,8 @@ func main() {
log.Fatalf("Invalid -depth argument: %d", *maxDepth)
}
+ // Add "https://" scheme prefix if missing. It looks like we
+ // have to do this before the parsing step, not after.
if !strings.HasPrefix(*startRawURL, "http://") && !strings.HasPrefix(*startRawURL, "https://") {
*startRawURL = "https://" + *startRawURL
fmt.Printf("start url: %s\n", *startRawURL)
@@ -54,6 +58,8 @@ func main() {
log.Fatal(err)
}
+ // Our web crawlers use concurrency: check if any goroutines
+ // have leaked.
getLeakProfile(func() {
classic(*startURL, *maxConcurrency, *maxURLs, *maxDepth)
})