docs: document packages, exported API and non-obvious logic

This commit is contained in:
Mathis Maquenne
2026-08-06 13:04:10 +02:00
parent 5dfd832d0d
commit b1ad9b4904
41 changed files with 757 additions and 7 deletions
+11 -1
View File
@@ -14,7 +14,11 @@ const (
repoName = "godeez"
latestReleaseURL = "https://api.github.com/repos/" + repoOwner + "/" + repoName + "/releases/latest"
checksumsAsset = "checksums.txt"
maxResponseSize = 1 << 20
// maxResponseSize caps what is read from GitHub, so a malformed or
// hostile response cannot exhaust memory. Release JSON and the checksums
// file are both a few kilobytes.
maxResponseSize = 1 << 20
)
var githubAPIHeaders = map[string]string{
@@ -67,6 +71,12 @@ func (r *Release) asset(name string) (Asset, bool) {
return Asset{}, false
}
// assetForRuntime finds the release asset for the current platform.
//
// The name is reconstructed from the goreleaser naming template rather than
// discovered, so this has to stay in step with the name_template in
// .goreleaser.yaml: a change there breaks self-update for everyone already
// running an older build.
func (r *Release) assetForRuntime() (Asset, error) {
name := fmt.Sprintf("%s_%s_%s_%s", repoName, r.Version(), runtime.GOOS, runtime.GOARCH)
if runtime.GOOS == "windows" {