summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-28 16:41:53 -0400
committerdemo <demo@antix1>2026-05-28 16:41:53 -0400
commit0d4e903fef12b5ed7d79cc097f3b18d2869ada29 (patch)
tree56cc9d5560f857142317980ce0d3b5052a4eb4d7
parentd217b6d89d03487bfa1d45c5cb750b27de8a45e5 (diff)
docs: add some comments
-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)
})