-
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
Changes from all commits
a164d25
24e129b
1483592
048099b
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() | ||
|
Member
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(non-blocking): Would setting this version above - before 👾 ramble: I'm unsure if this value is set here due to dependencies above, but I might expect the version to remain stable during execution here!
Member
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. 🗣️ ramble: Forgive me if the
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 have a branch that removes |
||
|
|
||
| // 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 (
Member
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: For this 🌟 praise: Thanks for catching this in these updates still! |
||
|
|
||
| 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().