Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions internal/ghcmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, <https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/gh.rb>.
var updaterEnabled = ""

type exitCode int

const (
Expand Down
6 changes: 6 additions & 0 deletions internal/ghcmd/update_disabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build !updateable

package ghcmd

// See update_enabled.go comment for more information.
var updaterEnabled = ""
18 changes: 18 additions & 0 deletions internal/ghcmd/update_enabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//go:build updateable

package ghcmd

// `updateable` is a build tag set in the gh formula within homebrew/homebrew-core
// and is used to control whether users are notified of newer GitHub CLI releases.
//
// Currently, updaterEnabled needs to be set to 'cli/cli' as it affects where
// update.CheckForUpdate() checks for releases. It is unclear to what extent
// this updaterEnabled is being used by unofficial forks or builds, so we decided
// to leave it available for injection as a string variable for now.
//
// Development builds do not generate update messages by default.
//
// For more information, see:
// - the Homebrew formula for gh: <https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/gh.rb>.
// - a discussion about adding this build tag: <https://github.com/cli/cli/pull/11024#discussion_r2107597618>.
var updaterEnabled = "cli/cli"
10 changes: 9 additions & 1 deletion script/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ 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")

args := []string{"go", "build", "-trimpath"}
if buildTags != "" {
args = append(args, "-tags", buildTags)
}
args = append(args, "-ldflags", ldflags, "-o", exe, "./cmd/gh")

return run(args...)
},
"manpages": func(_ string) error {
return run("go", "run", "./cmd/gen-docs", "--man-page", "--doc-path", "./share/man/man1/")
Expand Down
Loading