Files
lazygit/pkg/updates/build_source.go
Stefan HallerandClaude Opus 5.5 2ab7060644 Add a way to tell how lazygit was installed
The update check needs to know how lazygit was installed. We can only
update it in place if it was installed from one of our release
archives. If a package manager installed it, overwriting it would make
the package manager report the wrong version; in that case we can only
tell the user about the update, and maybe show the command that
updates it.

The build source alone isn't enough to decide this. Scoop, winget,
Chocolatey, mise and others install our release archives unchanged, so
their binaries have the build source "binaryRelease" too. We recognize
those by the folder that the executable is in.

The test for the build source in .goreleaser.yml guards against a
mismatch like the one in the current update code, which checks for
"buildBinary" instead of "binaryRelease".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:11:45 +01:00

16 lines
489 B
Go

package updates
// The build sources that lazygit knows about. The build source is set with
// `-X main.buildSource=...` when building lazygit.
const (
// Set by .goreleaser.yml for our release archives
BuildSourceRelease = "binaryRelease"
// Set by the Homebrew formula (to the name of the tap's owner)
BuildSourceHomebrew = "Homebrew"
// Set by mergeBuildInfo for builds made with
// `go install github.com/jesseduffield/lazygit@<version>`
BuildSourceGoInstall = "goInstall"
)