From eae74f26ada313c15057013a1df6b81b50d94a90 Mon Sep 17 00:00:00 2001 From: demo Date: Thu, 28 May 2026 13:25:42 -0400 Subject: feat: prettify stats when figure was passed in as 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code understands 0 as "no limit", but I want to convey the no-limit concept to readers of the file who don't have a notion of how the program works. So I convert 0 to ∞ in the string output here. --- xml.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xml.go b/xml.go index e1a253f..74ecc0d 100644 --- a/xml.go +++ b/xml.go @@ -37,7 +37,7 @@ func toSitemap(seen map[url.URL]int, maxDepth, maxURLs int) (string, error) { set := XMLURLset{ Xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9", URLs: xmlURLs, - Comment: fmt.Sprintf("max depth: %d, max urls: %d", maxDepth, maxURLs), + Comment: fmt.Sprintf("max depth: %s, max urls: %s", toSymbol(maxDepth), toSymbol(maxURLs)), } output, err := xml.MarshalIndent(&set, "", "\t") @@ -48,3 +48,11 @@ func toSitemap(seen map[url.URL]int, maxDepth, maxURLs int) (string, error) { withHeader := fmt.Sprintf("%s\n%s", xml.Header, output) return withHeader, nil } + +func toSymbol(figure int) string { + if figure == 0 { + return "∞" + } + + return fmt.Sprintf("%d", figure) +} -- cgit v1.2.3