@@ -12,7 +12,7 @@ import (
1212
1313 surveyCore "github.com/AlecAivazis/survey/v2/core"
1414 "github.com/cli/cli/api"
15- "github.com/cli/cli/command "
15+ "github.com/cli/cli/build "
1616 "github.com/cli/cli/internal/config"
1717 "github.com/cli/cli/internal/ghinstance"
1818 "github.com/cli/cli/internal/run"
@@ -29,10 +29,12 @@ import (
2929var updaterEnabled = ""
3030
3131func main () {
32- currentVersion := command .Version
32+ buildDate := build .Date
33+ buildVersion := build .Version
34+
3335 updateMessageChan := make (chan * update.ReleaseInfo )
3436 go func () {
35- rel , _ := checkForUpdate (currentVersion )
37+ rel , _ := checkForUpdate (buildVersion )
3638 updateMessageChan <- rel
3739 }()
3840
@@ -42,7 +44,7 @@ func main() {
4244 ghinstance .OverrideDefault (hostFromEnv )
4345 }
4446
45- cmdFactory := factory .New (command . Version )
47+ cmdFactory := factory .New (buildVersion )
4648 stderr := cmdFactory .IOStreams .ErrOut
4749 if ! cmdFactory .IOStreams .ColorEnabled () {
4850 surveyCore .DisableColor = true
@@ -61,7 +63,7 @@ func main() {
6163 }
6264 }
6365
64- rootCmd := root .NewCmdRoot (cmdFactory , command . Version , command . BuildDate )
66+ rootCmd := root .NewCmdRoot (cmdFactory , buildVersion , buildDate )
6567
6668 cfg , err := cmdFactory .Config ()
6769 if err != nil {
@@ -151,7 +153,7 @@ func main() {
151153 if newRelease != nil {
152154 msg := fmt .Sprintf ("%s %s → %s\n %s" ,
153155 ansi .Color ("A new release of gh is available:" , "yellow" ),
154- ansi .Color (currentVersion , "cyan" ),
156+ ansi .Color (buildVersion , "cyan" ),
155157 ansi .Color (newRelease .Version , "cyan" ),
156158 ansi .Color (newRelease .URL , "yellow" ))
157159
@@ -208,7 +210,7 @@ func checkForUpdate(currentVersion string) (*update.ReleaseInfo, error) {
208210 return nil , nil
209211 }
210212
211- client , err := basicClient ()
213+ client , err := basicClient (currentVersion )
212214 if err != nil {
213215 return nil , err
214216 }
@@ -220,12 +222,12 @@ func checkForUpdate(currentVersion string) (*update.ReleaseInfo, error) {
220222
221223// BasicClient returns an API client for github.com only that borrows from but
222224// does not depend on user configuration
223- func basicClient () (* api.Client , error ) {
225+ func basicClient (currentVersion string ) (* api.Client , error ) {
224226 var opts []api.ClientOption
225227 if verbose := os .Getenv ("DEBUG" ); verbose != "" {
226228 opts = append (opts , apiVerboseLog ())
227229 }
228- opts = append (opts , api .AddHeader ("User-Agent" , fmt .Sprintf ("GitHub CLI %s" , command . Version )))
230+ opts = append (opts , api .AddHeader ("User-Agent" , fmt .Sprintf ("GitHub CLI %s" , currentVersion )))
229231
230232 token := os .Getenv ("GITHUB_TOKEN" )
231233 if token == "" {
0 commit comments