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
+16 -1
View File
@@ -1,3 +1,10 @@
// Package update handles both halves of keeping godeez current: the passive
// background check that tells the user a newer release exists, and the
// `godeez update` command that installs it.
//
// Releases come from the GitHub releases API. Downloads are verified against
// the published checksums file before anything replaces the running binary,
// and installs owned by a package manager are refused rather than overwritten.
package update
import (
@@ -11,9 +18,13 @@ import (
)
const (
// Timeouts are per request rather than for the whole operation, so a slow
// but progressing download is not killed part way. The generous download
// timeout covers a binary of a few tens of megabytes on a poor connection.
apiTimeout = 30 * time.Second
downloadTimeout = 5 * time.Minute
tmpPattern = ".godeez-update-*"
tmpPattern = ".godeez-update-*"
)
type Updater struct {
@@ -21,6 +32,10 @@ type Updater struct {
Out io.Writer
}
// New returns an Updater that reports nothing. Callers that want the step by
// step progress, such as the update command, set Out themselves; the
// background check leaves it discarding so it cannot write over the download
// output.
func New() *Updater {
return &Updater{
client: &http.Client{},