diff --git a/internal/ghcmd/cmd.go b/internal/ghcmd/cmd.go index bd901b78e..9fc5bcefe 100644 --- a/internal/ghcmd/cmd.go +++ b/internal/ghcmd/cmd.go @@ -29,14 +29,6 @@ import ( "github.com/spf13/cobra" ) -// updaterEnabled is a statically linked build property set in gh formula within homebrew/homebrew-core -// used to control whether users are notified of newer GitHub CLI releases. -// This needs to be set to 'cli/cli' as it affects where update.CheckForUpdate() checks for releases. -// It is unclear whether this means that only homebrew builds will check for updates or not. -// Development builds leave this empty as impossible to determine if newer or not. -// For more information, . -var updaterEnabled = "" - type exitCode int const ( diff --git a/internal/ghcmd/update_disabled.go b/internal/ghcmd/update_disabled.go new file mode 100644 index 000000000..3fb7a7f4f --- /dev/null +++ b/internal/ghcmd/update_disabled.go @@ -0,0 +1,11 @@ +//go:build !updateable + +package ghcmd + +// updaterEnabled is a statically linked build property set in gh formula within homebrew/homebrew-core +// used to control whether users are notified of newer GitHub CLI releases. +// This needs to be set to 'cli/cli' as it affects where update.CheckForUpdate() checks for releases. +// It is unclear whether this means that only homebrew builds will check for updates or not. +// Development builds leave this empty as impossible to determine if newer or not. +// For more information, . +var updaterEnabled = "" diff --git a/internal/ghcmd/update_enabled.go b/internal/ghcmd/update_enabled.go new file mode 100644 index 000000000..5a136885b --- /dev/null +++ b/internal/ghcmd/update_enabled.go @@ -0,0 +1,11 @@ +//go:build updateable + +package ghcmd + +// updaterEnabled is a statically linked build property set in gh formula within homebrew/homebrew-core +// used to control whether users are notified of newer GitHub CLI releases. +// This needs to be set to 'cli/cli' as it affects where update.CheckForUpdate() checks for releases. +// It is unclear whether this means that only homebrew builds will check for updates or not. +// Development builds leave this empty as impossible to determine if newer or not. +// For more information, . +var updaterEnabled = "cli/cli" diff --git a/script/build.go b/script/build.go index d7085f590..08a193ffc 100644 --- a/script/build.go +++ b/script/build.go @@ -53,7 +53,9 @@ var tasks = map[string]func(string) error{ ldflags = fmt.Sprintf("-X github.com/cli/cli/v2/internal/authflow.oauthClientID=%s %s", os.Getenv("GH_OAUTH_CLIENT_ID"), ldflags) } - return run("go", "build", "-trimpath", "-ldflags", ldflags, "-o", exe, "./cmd/gh") + buildTags, _ := os.LookupEnv("GO_BUILDTAGS") + + return run("go", "build", "-trimpath", "-tags", buildTags, "-ldflags", ldflags, "-o", exe, "./cmd/gh") }, "manpages": func(_ string) error { return run("go", "run", "./cmd/gen-docs", "--man-page", "--doc-path", "./share/man/man1/")