Documentation
¶
Overview ¶
Package selfupdate replaces the running agent2api binary with the latest published release.
It deliberately mirrors scripts/install.sh — same release, same archive names, same checksums.txt — so a machine ends up with exactly the file the installer would have written. One rule is stricter: a checksum that is missing or does not match is fatal here. The installer is creating a file that did not exist and can reasonably warn and continue; update overwrites a binary the user already trusts, so it gets no "skipping verification" path.
Index ¶
Constants ¶
const (
// DefaultRepo is the GitHub repository releases are published to.
DefaultRepo = "Dongss/agent2api"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Current is the version this build reports, e.g. "v0.1.0". An update is
// skipped when it already equals the latest tag.
Current string
// Repo is "owner/name"; defaults to [DefaultRepo].
Repo string
// BaseURL overrides the release host. For tests.
BaseURL string
// Client overrides the HTTP client. For tests.
Client *http.Client
// Dest is the binary to replace. Empty means the running executable.
Dest string
}
Options configures one update. The zero value updates the running binary from the project's own GitHub releases, which is what the CLI passes.
type Result ¶
type Result struct {
// From is the version that was installed, To the latest release. They are
// equal exactly when Updated is false.
From, To string
// Path is the binary that was (or would have been) replaced.
Path string
// Updated reports whether the binary on disk changed.
Updated bool
}
Result describes what an update did, including the case where it did nothing because the binary was already current.