From 0d4e903fef12b5ed7d79cc097f3b18d2869ada29 Mon Sep 17 00:00:00 2001 From: demo Date: Thu, 28 May 2026 16:41:53 -0400 Subject: docs: add some comments --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) 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) }) -- cgit v1.2.3