-
Notifications
You must be signed in to change notification settings - Fork 32
refactor: remove legacy CLIVersion field and SetVersion() function #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,7 +148,7 @@ func Init(ctx context.Context) (*cobra.Command, *shared.ClientFactory) { | |
| // updateNotification will check for an update in the background and print a message after the command runs | ||
| var updateNotification *update.UpdateNotification | ||
|
|
||
| clients = shared.NewClientFactory(shared.SetVersion(version.Raw())) | ||
| clients = shared.NewClientFactory() | ||
| rootCmd := NewRootCommand(clients, updateNotification) | ||
|
|
||
| // Support `--version` by setting root command's `Version` and custom template. | ||
|
|
@@ -265,7 +265,7 @@ func InitConfig(ctx context.Context, clients *shared.ClientFactory, rootCmd *cob | |
|
|
||
| // Init clients that use flags | ||
| clients.Config.APIHostResolved = clients.Auth().ResolveAPIHost(ctx, clients.Config.APIHostFlag, nil) | ||
| clients.Config.LogstashHostResolved = clients.Auth().ResolveLogstashHost(ctx, clients.Config.APIHostResolved, clients.CLIVersion) | ||
| clients.Config.LogstashHostResolved = clients.Auth().ResolveLogstashHost(ctx, clients.Config.APIHostResolved, version.Raw()) | ||
|
|
||
| // Init System ID | ||
| if systemID, err := clients.Config.SystemConfig.InitSystemID(ctx); err != nil { | ||
|
|
@@ -297,7 +297,7 @@ func InitConfig(ctx context.Context, clients *shared.ClientFactory, rootCmd *cob | |
| clients.Config.LoadExperiments(ctx, clients.IO.PrintDebug) | ||
| style.ToggleLipgloss(clients.Config.WithExperimentOn(experiment.Lipgloss)) | ||
| // TODO(slackcontext) Consolidate storing CLI version to slackcontext | ||
| clients.Config.Version = clients.CLIVersion | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: |
||
| clients.Config.Version = version.Raw() | ||
|
|
||
| // The domain auths (token->domain) shouldn't change for the execution of the CLI so preload them into config! | ||
| clients.Config.DomainAuthTokens = clients.Auth().MapAuthTokensToDomains(ctx) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,8 @@ func main() { | |
| func recoveryFunc() { | ||
| // in the event of a panic, log panic | ||
| if r := recover(); r != nil { | ||
| var clients = shared.NewClientFactory(shared.SetVersion(version.Raw())) | ||
| var clients = shared.NewClientFactory() | ||
| clients.Config.Version = version.Raw() | ||
|
Comment on lines
+83
to
+84
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: I still don't like that we're setting the version in multiple places, instead of just referencing the source of truth ( |
||
|
|
||
| var ctx = context.Background() | ||
| ctx = slackcontext.SetSessionID(ctx, uuid.New().String()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note:
clients.CLIVersionwas set toversion.Raw().