From d6789522d3dd076f7c98dafa3e7d42df09252093 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 15 Jul 2026 02:25:20 -0500 Subject: fix: document exported API, fix naming, and harden Download The remaining golangci-lint findings. These land together because the Url -> URL rename spans util.go, parsers.go and wrapper.go, and splitting it would leave an intermediate commit that does not compile. Download() carried the most serious bug here: try() only prints an error, it does not return, so a failed request fell through to resp.Body.Close() on a nil resp and panicked. Every failure path now returns the zero Downloaded, and callers check Status. ReturnHTTPError guards against the resulting status 0, which would otherwise panic WriteHeader. Requests carry a context with a timeout (noctx), and a download-proxy now routes through ProxiedTransport so it keeps the DA throttle and timeouts. Also: - doc comments on all 48 exported symbols (revive's exported rule, with checkPrivateReceivers, since most of app is exported methods on the unexported skunkyart type), plus package docs in new doc.go files so both the embed and non-embed builds are covered. - ST1003 naming: UrlBuilder -> URLBuilder, id_search -> idSearch, cache_config -> cacheConfig, TXT_RAW -> TxtRaw, mediaUrl -> mediaURL. - explicit json tags on structs that are unmarshaled (musttag); the hyphenated keys already had tags, the rest relied on case-insensitive fallback. Behaviour is unchanged. - modernization: range-over-int, WaitGroup.Go, stale +build lines, interface{} -> any, strings.Builder over string concatenation in a loop. --- static/doc.go | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 static/doc.go (limited to 'static/doc.go') diff --git a/static/doc.go b/static/doc.go new file mode 100644 index 0000000..a578372 --- /dev/null +++ b/static/doc.go @@ -0,0 +1,8 @@ +// Package static provides the HTML templates, stylesheet and images the +// frontend serves. +// +// It has two implementations selected by the 'embed' build tag. With the tag, +// the assets are compiled into the binary via go:embed. Without it, they are +// read from the directory named by StaticPath at startup and held in memory, +// which is what makes editing templates without a rebuild possible. +package static -- cgit v1.2.3