From 3dc741ebc0f7d6c250d2af866331ac89b0f8fc95 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 00:41:45 +0000 Subject: [PATCH 1/3] build(deps): bump golang to 1.26.0 --- .circleci/config.yml | 2 +- .github/workflows/tests.yml | 4 ++-- go.mod | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 28a74420..b0ad6b81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -113,7 +113,7 @@ jobs: default: "dev-build" docker: # run the steps with Docker # CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/ - - image: cimg/go:1.25.7 + - image: cimg/go:1.26.0 steps: # steps that comprise the `build` job - checkout # check out source code to working directory - restore_cache: # restores saved cache if no changes are detected since last run diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3b842097..a02d7dc4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: "1.25.7" + go-version: "1.26.0" - name: Lint uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: @@ -57,7 +57,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: "1.25.7" + go-version: "1.26.0" - name: Report health score uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1 with: diff --git a/go.mod b/go.mod index c6581194..f7fb8abe 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/slackapi/slack-cli -go 1.25.7 +go 1.26.0 require ( github.com/AlecAivazis/survey/v2 v2.3.7 From 09e05b72f3bd67672c00c2c7f4390a615a19de0b Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 18 Feb 2026 17:45:55 -0800 Subject: [PATCH 2/3] style: govet print formatting to avoid unexpected variable --- cmd/app/add.go | 2 +- cmd/app/app.go | 6 ++---- cmd/app/link.go | 2 +- cmd/auth/login.go | 4 ++-- cmd/auth/logout.go | 4 ++-- cmd/auth/revoke.go | 4 ++-- cmd/datastore/count.go | 4 ++-- cmd/datastore/datastore.go | 4 ++-- cmd/datastore/query.go | 2 +- cmd/env/add.go | 2 +- cmd/env/list.go | 2 +- cmd/externalauth/add_secret.go | 2 +- cmd/externalauth/remove.go | 4 ++-- cmd/feedback/feedback.go | 24 +++++++++++------------- cmd/function/access.go | 10 ++++------ cmd/manifest/info.go | 2 +- cmd/manifest/validate.go | 2 +- cmd/platform/deploy.go | 2 +- cmd/project/create.go | 6 +++--- cmd/project/create_template.go | 4 ++-- cmd/project/init.go | 4 ++-- cmd/project/samples.go | 2 +- cmd/root.go | 6 +++--- cmd/triggers/access.go | 24 ++++++++++++------------ cmd/triggers/create.go | 4 ++-- cmd/triggers/generate.go | 6 +++--- cmd/triggers/triggers.go | 2 +- internal/api/debug.go | 4 ++-- internal/iostreams/writer.go | 2 +- internal/pkg/apps/install.go | 10 +++++----- internal/pkg/create/create.go | 10 +++++----- internal/pkg/manifest/validate.go | 2 +- internal/pkg/platform/activity.go | 2 +- internal/prompts/app_select.go | 6 +++--- internal/runtime/node/npm.go | 6 +++--- 35 files changed, 88 insertions(+), 94 deletions(-) diff --git a/cmd/app/add.go b/cmd/app/add.go index fb21a3c3..39b4623c 100644 --- a/cmd/app/add.go +++ b/cmd/app/add.go @@ -127,7 +127,7 @@ func RunAddCommand(ctx context.Context, clients *shared.ClientFactory, selection } clients.Config.Flags.Lookup("environment").Changed = true - clients.IO.PrintInfo(ctx, false, "\n"+style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "\n%s", style.Sectionf(style.TextSection{ Emoji: "warning", Text: "Warning: Default App Environment", Secondary: []string{ diff --git a/cmd/app/app.go b/cmd/app/app.go index e97d2b22..6dbf69aa 100644 --- a/cmd/app/app.go +++ b/cmd/app/app.go @@ -15,8 +15,6 @@ package app import ( - "fmt" - "github.com/slackapi/slack-cli/internal/cmdutil" "github.com/slackapi/slack-cli/internal/shared" "github.com/slackapi/slack-cli/internal/style" @@ -51,13 +49,13 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command { ctx := cmd.Context() // DEPRECATED(semver:major): remove the "workspace" alias if cmd.CalledAs() == "workspace" { - clients.IO.PrintInfo(ctx, false, fmt.Sprintf( + clients.IO.PrintInfo(ctx, false, "\n%s It looks like you used %s. This command will be deprecated in an upcoming release.\n You can now use %s instead of %s.\n ", style.Emoji("bulb"), style.Commandf("workspace", true), style.Commandf("app", true), style.Commandf("workspace", true), - )) + ) } return nil }, diff --git a/cmd/app/link.go b/cmd/app/link.go index a58ba8cb..d13f49fb 100644 --- a/cmd/app/link.go +++ b/cmd/app/link.go @@ -214,7 +214,7 @@ func LinkExistingApp(ctx context.Context, clients *shared.ClientFactory, app *ty fmt.Sprintf(`manifest.source: "%s"`, config.ManifestSourceRemote), ). WithRootCause(err) - clients.IO.PrintError(ctx, slackErr.Error()) + clients.IO.PrintError(ctx, "%s", slackErr.Error()) } } diff --git a/cmd/auth/login.go b/cmd/auth/login.go index 9141d6b5..9159e256 100644 --- a/cmd/auth/login.go +++ b/cmd/auth/login.go @@ -148,7 +148,7 @@ func printAuthSuccess(cmd *cobra.Command, IO iostreams.IOStreamer, credentialsPa func printAuthNextSteps(ctx context.Context, clients *shared.ClientFactory) { project, _ := clients.SDKConfig.Exists() if !project { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "bulb", Text: fmt.Sprintf("Get started by creating a new app with %s", style.Commandf("create my-app", true)), Secondary: []string{ @@ -156,7 +156,7 @@ func printAuthNextSteps(ctx context.Context, clients *shared.ClientFactory) { }, })) } else { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "bulb", Text: fmt.Sprintf("Review existing installations of the app with %s", style.Commandf("app list", false)), Secondary: []string{ diff --git a/cmd/auth/logout.go b/cmd/auth/logout.go index 2306c009..b5937f51 100644 --- a/cmd/auth/logout.go +++ b/cmd/auth/logout.go @@ -212,11 +212,11 @@ func printLogoutSuccess(ctx context.Context, clients *shared.ClientFactory, auth } clients.IO.PrintTrace(ctx, slacktrace.AuthLogoutSuccess) - clients.IO.PrintInfo(ctx, false, fmt.Sprintf("\n%s", style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "\n%s", style.Sectionf(style.TextSection{ Emoji: "wastebasket", Text: revokedAuthText, Secondary: logoutNextSteps, - }))) + })) } // FormatAuthLabel returns a formatted auth label for user selection during logout diff --git a/cmd/auth/revoke.go b/cmd/auth/revoke.go index 94f61264..f926fd1b 100644 --- a/cmd/auth/revoke.go +++ b/cmd/auth/revoke.go @@ -72,9 +72,9 @@ func printRevokeSuccess(ctx context.Context, clients *shared.ClientFactory) { } clients.IO.PrintTrace(ctx, slacktrace.AuthRevokeSuccess) - clients.IO.PrintInfo(ctx, false, fmt.Sprintf("\n%s", style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "\n%s", style.Sectionf(style.TextSection{ Emoji: "wastebasket", Text: revokedAuthText, Secondary: logoutNextSteps, - }))) + })) } diff --git a/cmd/datastore/count.go b/cmd/datastore/count.go index 565ee2d4..75915982 100644 --- a/cmd/datastore/count.go +++ b/cmd/datastore/count.go @@ -147,7 +147,7 @@ func printCountResult(ctx context.Context, clients *shared.ClientFactory, countR clients.IO.PrintTrace(ctx, slacktrace.DatastoreCountSuccess) clients.IO.PrintTrace(ctx, slacktrace.DatastoreCountTotal, fmt.Sprintf("%d", countResult.Count)) clients.IO.PrintTrace(ctx, slacktrace.DatastoreCountDatastore, countResult.Datastore) - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "tada", Text: fmt.Sprintf( "Counted %d matching items from datastore: %s", @@ -203,7 +203,7 @@ func promptDatastoreCountRequest( // Display a hint for writing expressions clients.IO.PrintInfo(ctx, false, "") - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "bulb", Text: "Expressions should use the following format", Secondary: []string{ diff --git a/cmd/datastore/datastore.go b/cmd/datastore/datastore.go index 08dcdbb6..b8cae87f 100644 --- a/cmd/datastore/datastore.go +++ b/cmd/datastore/datastore.go @@ -162,11 +162,11 @@ func printDatastoreExpressionMarshal(ctx context.Context, clients *shared.Client return err } clients.IO.PrintInfo(ctx, false, "") - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "open_file_folder", Text: "This expression can be represented by the following JSON:", })) - clients.IO.PrintInfo(ctx, false, style.Secondary(expression)) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(expression)) return nil } diff --git a/cmd/datastore/query.go b/cmd/datastore/query.go index c528e3d8..405040cd 100644 --- a/cmd/datastore/query.go +++ b/cmd/datastore/query.go @@ -277,7 +277,7 @@ func promptDatastoreQueryRequest( // Display a hint for writing expressions clients.IO.PrintInfo(ctx, false, "") - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "bulb", Text: "Expressions should use the following format", Secondary: []string{ diff --git a/cmd/env/add.go b/cmd/env/add.go index 2f11f152..f48c47dd 100644 --- a/cmd/env/add.go +++ b/cmd/env/add.go @@ -108,7 +108,7 @@ func runEnvAddCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command, arg // Display the variable name before getting the variable value if len(args) < 2 && !clients.Config.Flags.Lookup("value").Changed { mimickedInput := iostreams.MimicInputPrompt("Variable name", variableName) - clients.IO.PrintInfo(ctx, false, mimickedInput) + clients.IO.PrintInfo(ctx, false, "%s", mimickedInput) } } diff --git a/cmd/env/list.go b/cmd/env/list.go index 02458a8e..f61dd736 100644 --- a/cmd/env/list.go +++ b/cmd/env/list.go @@ -124,7 +124,7 @@ func runEnvListCommandFunc( ) } clients.IO.PrintTrace(ctx, slacktrace.EnvListVariables, variableNames...) - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "evergreen_tree", Text: "App Environment", Secondary: variableLabel, diff --git a/cmd/externalauth/add_secret.go b/cmd/externalauth/add_secret.go index df3f4c0c..3df730c5 100644 --- a/cmd/externalauth/add_secret.go +++ b/cmd/externalauth/add_secret.go @@ -132,7 +132,7 @@ func runAddClientSecretCommand(clients *shared.ClientFactory, cmd *cobra.Command return err } - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "sparkles", Text: fmt.Sprintf( "Successfully added external auth client secret for %s", diff --git a/cmd/externalauth/remove.go b/cmd/externalauth/remove.go index 6ee4fa20..d744e2d7 100644 --- a/cmd/externalauth/remove.go +++ b/cmd/externalauth/remove.go @@ -100,7 +100,7 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error { return err } - clients.IO.PrintInfo(ctx, false, style.Highlight("\nNote that this command will not revoke existing tokens, only remove them from Slack systems. You might be able to revoke them from a provider's dev console or APIs\n")) + clients.IO.PrintInfo(ctx, false, "%s", style.Highlight("\nNote that this command will not revoke existing tokens, only remove them from Slack systems. You might be able to revoke them from a provider's dev console or APIs\n")) confirmMessage := "Are you sure you want to remove all tokens for this app relevant to the specified provider from your current team/org?" if allProvidersFlag { @@ -231,6 +231,6 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error { ) } - clients.IO.PrintInfo(ctx, false, text) + clients.IO.PrintInfo(ctx, false, "%s", text) return nil } diff --git a/cmd/feedback/feedback.go b/cmd/feedback/feedback.go index 43e7ebe4..276bdcec 100644 --- a/cmd/feedback/feedback.go +++ b/cmd/feedback/feedback.go @@ -91,14 +91,13 @@ var SurveyStore = map[string]SlackSurvey{ RawPath: "https://github.com/slackapi/slack-cli/issues", }, Info: func(ctx context.Context, clients *shared.ClientFactory) { - clients.IO.PrintInfo(ctx, false, fmt.Sprintf( - "%s\n%s\n", + clients.IO.PrintInfo(ctx, false, "%s\n%s\n", style.Secondary("Ask questions, submit issues, or suggest features for the Slack CLI:"), style.Secondary(style.Highlight("https://github.com/slackapi/slack-cli/issues")), - )) + ) }, Ask: func(ctx context.Context, clients *shared.ClientFactory) (bool, error) { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "love_letter", Text: "We would love to know how things are going", Secondary: []string{ @@ -119,14 +118,13 @@ var SurveyStore = map[string]SlackSurvey{ PromptDescription: "Developer support for the Slack Platform, Slack API, Block Kit, and more", URL: url.URL{RawPath: "https://docs.slack.dev/developer-support"}, Info: func(ctx context.Context, clients *shared.ClientFactory) { - clients.IO.PrintInfo(ctx, false, fmt.Sprintf( - "%s\n%s\n", + clients.IO.PrintInfo(ctx, false, "%s\n%s\n", style.Secondary("You can send us a message at "+style.Highlight(email)), style.Secondary("Or, share your experiences at "+style.Highlight("https://docs.slack.dev/developer-support")), - )) + ) }, Ask: func(ctx context.Context, clients *shared.ClientFactory) (bool, error) { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "love_letter", Text: "We would love to know how things are going", Secondary: []string{ @@ -260,7 +258,7 @@ func runFeedbackCommand(ctx context.Context, clients *shared.ClientFactory, cmd return slackerror.New(slackerror.ErrFeedbackNameRequired) } - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "love_letter", Text: leadMessage, })) @@ -304,7 +302,7 @@ func initSurveyOpts(ctx context.Context, clients *shared.ClientFactory, surveys var opts []string for _, s := range sortedSurveys { if s.Config == nil { - clients.IO.PrintDebug(ctx, fmt.Sprintf("survey config not set; skipping %s", s.Name)) + clients.IO.PrintDebug(ctx, "survey config not set; skipping %s", s.Name) continue } names = append(names, s.Name) @@ -322,7 +320,7 @@ func initSurveyOpts(ctx context.Context, clients *shared.ClientFactory, surveys } t, err := time.Parse(time.RFC3339, cfg.CompletedAt) if err != nil { - clients.IO.PrintDebug(ctx, err.Error()) + clients.IO.PrintDebug(ctx, "%s", err.Error()) opts = append(opts, s.PromptDisplayText) continue } @@ -362,7 +360,7 @@ func executeSurvey(ctx context.Context, clients *shared.ClientFactory, s SlackSu if ok { // Open survey in browser clients.Browser().OpenURL(url) } else { // Print survey URL - clients.IO.PrintInfo(ctx, false, fmt.Sprint("Feedback URL: \n", style.Secondary(url))) + clients.IO.PrintInfo(ctx, false, "Feedback URL: \n%s", style.Secondary(url)) } // Record completion @@ -465,6 +463,6 @@ func ShowSurveyMessages(ctx context.Context, clients *shared.ClientFactory) erro func ShowFeedbackMessageOnTerminate(ctx context.Context, clients *shared.ClientFactory) { err := ShowSurveyMessages(ctx, clients) if err != nil { - clients.IO.PrintError(ctx, err.Error()) + clients.IO.PrintError(ctx, "%s", err.Error()) } } diff --git a/cmd/function/access.go b/cmd/function/access.go index 7eea19ce..3ee4f9c1 100644 --- a/cmd/function/access.go +++ b/cmd/function/access.go @@ -281,10 +281,9 @@ func distributePermissionFile(ctx context.Context, clients *shared.ClientFactory switch permissions.Type { case types.PermissionNamedEntities: if len(permissions.UserIDs) == 0 { - clients.IO.PrintWarning(ctx, fmt.Sprintf( - "No users will have access to '%s'", + clients.IO.PrintWarning(ctx, "No users will have access to '%s'", function, - )) + ) } err := updateNamedEntitiesDistribution(ctx, clients, app, function, permissions.UserIDs) if err != nil { @@ -292,11 +291,10 @@ func distributePermissionFile(ctx context.Context, clients *shared.ClientFactory } default: if len(permissions.UserIDs) != 0 { - clients.IO.PrintWarning(ctx, fmt.Sprintf( - "The supplied user IDs to '%s' are overridden by the '%s' permission", + clients.IO.PrintWarning(ctx, "The supplied user IDs to '%s' are overridden by the '%s' permission", function, permissions.Type, - )) + ) } _, err := clients.API().FunctionDistributionSet(ctx, function, app.AppID, permissions.Type, "") if err != nil { diff --git a/cmd/manifest/info.go b/cmd/manifest/info.go index bd4b521e..b9c5b9de 100644 --- a/cmd/manifest/info.go +++ b/cmd/manifest/info.go @@ -94,7 +94,7 @@ func runInfoCommand(cmd *cobra.Command, clients *shared.ClientFactory) error { if err != nil { return err } - clients.IO.PrintInfo(ctx, false, string(manifest)) + clients.IO.PrintInfo(ctx, false, "%s", string(manifest)) return nil } diff --git a/cmd/manifest/validate.go b/cmd/manifest/validate.go index 1ccac80b..c98ee063 100644 --- a/cmd/manifest/validate.go +++ b/cmd/manifest/validate.go @@ -84,7 +84,7 @@ func NewValidateCommand(clients *shared.ClientFactory) *cobra.Command { return err } if warn != nil { - clients.IO.PrintWarning(ctx, warn.Warning(clients.Config.DebugEnabled, "The following warnings were raised during manifest validation")) + clients.IO.PrintWarning(ctx, "%s", warn.Warning(clients.Config.DebugEnabled, "The following warnings were raised during manifest validation")) return nil } if log != nil { diff --git a/cmd/platform/deploy.go b/cmd/platform/deploy.go index f11d85c3..8a78a3e7 100644 --- a/cmd/platform/deploy.go +++ b/cmd/platform/deploy.go @@ -308,7 +308,7 @@ func printDeployHostingCompletion(clients *shared.ClientFactory, cmd *cobra.Comm }, }) - clients.IO.PrintInfo(ctx, false, navigateText) + clients.IO.PrintInfo(ctx, false, "%s", navigateText) return nil } diff --git a/cmd/project/create.go b/cmd/project/create.go index b869abc8..3c326b0d 100644 --- a/cmd/project/create.go +++ b/cmd/project/create.go @@ -236,7 +236,7 @@ func printCreateSuccess(ctx context.Context, clients *shared.ClientFactory, appP // Include documentation and information about ROSI for deno apps if isDenoProject { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "compass", Text: "Explore the documentation to learn more", Secondary: []string{ @@ -245,7 +245,7 @@ func printCreateSuccess(ctx context.Context, clients *shared.ClientFactory, appP }, })) - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "clipboard", Text: "Follow the steps below to begin development", Secondary: []string{ @@ -268,7 +268,7 @@ func printCreateSuccess(ctx context.Context, clients *shared.ClientFactory, appP "Start developing and see changes in real-time with "+style.Commandf("run", true), ) - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "clipboard", Text: "Next steps to begin development", Secondary: secondaryOutput, diff --git a/cmd/project/create_template.go b/cmd/project/create_template.go index 9cabfa98..45970097 100644 --- a/cmd/project/create_template.go +++ b/cmd/project/create_template.go @@ -216,7 +216,7 @@ func confirmExternalTemplateSelection(cmd *cobra.Command, clients *shared.Client return true, nil } - clients.IO.PrintWarning(ctx, style.Sectionf(style.TextSection{ + clients.IO.PrintWarning(ctx, "%s", style.Sectionf(style.TextSection{ Text: style.Bold("You are trying to use code published by an unknown author"), Secondary: []string{ "We strongly advise reviewing the source code and dependencies of external", @@ -267,7 +267,7 @@ func listTemplates(ctx context.Context, clients *shared.ClientFactory, categoryS for i, tmpl := range templates { secondary[i] = tmpl.Repository } - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "house_buildings", Text: style.Bold(category.name), Secondary: secondary, diff --git a/cmd/project/init.go b/cmd/project/init.go index 4ffe0089..904f2324 100644 --- a/cmd/project/init.go +++ b/cmd/project/init.go @@ -115,7 +115,7 @@ func projectInitCommandRunE(clients *shared.ClientFactory, cmd *cobra.Command, a err = app.LinkExistingApp(ctx, clients, &types.App{}, true) if err != nil { // Display the error but continue to init - clients.IO.PrintError(ctx, err.Error()) + clients.IO.PrintError(ctx, "%s", err.Error()) } printNextStepSection(ctx, clients, projectDirPath) @@ -141,7 +141,7 @@ func printNextStepSection(ctx context.Context, clients *shared.ClientFactory, pr "When you're ready to deploy for production with "+style.Commandf("deploy", true), ) - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "clipboard", Text: "Next steps to begin development", Secondary: secondaryOutput, diff --git a/cmd/project/samples.go b/cmd/project/samples.go index 84b5ca87..30352d4d 100644 --- a/cmd/project/samples.go +++ b/cmd/project/samples.go @@ -153,7 +153,7 @@ func listSampleSelection(ctx context.Context, clients *shared.ClientFactory, sam exampleRepos..., ) for _, sample := range samples { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "hammer_and_wrench", Text: fmt.Sprintf( " %s | %s | %d %s", diff --git a/cmd/root.go b/cmd/root.go index 3412d49a..e7358a35 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -207,7 +207,7 @@ func Init(ctx context.Context) (*cobra.Command, *shared.ClientFactory) { cobra.OnInitialize(func() { err := InitConfig(ctx, clients, rootCmd) if err != nil { - clients.IO.PrintError(ctx, err.Error()) + clients.IO.PrintError(ctx, "%s", err.Error()) clients.Os.Exit(int(iostreams.ExitError)) } }) @@ -374,7 +374,7 @@ func ExecuteContext(ctx context.Context, rootCmd *cobra.Command, clients *shared if err := rootCmd.ExecuteContext(ctx); err != nil { if slackerror.Is(err, slackerror.ErrProcessInterrupted) { clients.IO.SetExitCode(iostreams.ExitCancel) - clients.IO.PrintDebug(ctx, err.Error()) + clients.IO.PrintDebug(ctx, "%s", err.Error()) } else { if slackerror.Is(err, slackerror.ErrSDKHookNotFound) && clients.SDKConfig.Runtime == "" { err = slackerror.New(slackerror.ErrRuntimeNotFound). @@ -384,7 +384,7 @@ func ExecuteContext(ctx context.Context, rootCmd *cobra.Command, clients *shared case iostreams.ExitOK: clients.IO.SetExitCode(iostreams.ExitError) } - clients.IO.PrintError(ctx, err.Error()) + clients.IO.PrintError(ctx, "%s", err.Error()) } clients.EventTracker.SetErrorMessage(err.Error()) if slackErr, ok := err.(*slackerror.Error); ok { diff --git a/cmd/triggers/access.go b/cmd/triggers/access.go index 0a3177af..f4db5d7b 100644 --- a/cmd/triggers/access.go +++ b/cmd/triggers/access.go @@ -369,7 +369,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } users := strings.Split(accessFlags.users, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("User", "Users", len(users)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("User", "Users", len(users)), style.Emoji("party_popper")))) case "remove_user": if currentAccessType == types.PermissionNamedEntities && len(currentAuthorizedEntities) == 0 { @@ -385,7 +385,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } users := strings.Split(accessFlags.users, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("User", "Users", len(users)), style.Emoji("firecracker")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("User", "Users", len(users)), style.Emoji("firecracker")))) case "add_channel": if currentAccessType != types.PermissionNamedEntities { @@ -408,7 +408,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } channels := strings.Split(accessFlags.channels, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("Channel", "Channels", len(channels)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("Channel", "Channels", len(channels)), style.Emoji("party_popper")))) case "remove_channel": if currentAccessType == types.PermissionNamedEntities && len(currentAuthorizedEntities) == 0 { @@ -424,7 +424,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } channels := strings.Split(accessFlags.channels, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("Channel", "Channels", len(channels)), style.Emoji("firecracker")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("Channel", "Channels", len(channels)), style.Emoji("firecracker")))) case "add_workspace": if currentAccessType != types.PermissionNamedEntities { @@ -447,7 +447,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } workspaces := strings.Split(accessFlags.workspaces, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("Workspace", "Workspaces", len(workspaces)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("Workspace", "Workspaces", len(workspaces)), style.Emoji("party_popper")))) case "remove_workspace": if currentAccessType == types.PermissionNamedEntities && len(currentAuthorizedEntities) == 0 { @@ -463,7 +463,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } workspaces := strings.Split(accessFlags.workspaces, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("Workspace", "Workspaces", len(workspaces)), style.Emoji("firecracker")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("Workspace", "Workspaces", len(workspaces)), style.Emoji("firecracker")))) case "add_organization": if currentAccessType != types.PermissionNamedEntities { @@ -486,7 +486,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } organizations := strings.Split(accessFlags.organizations, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("Organization", "Organizations", len(organizations)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("Organization", "Organizations", len(organizations)), style.Emoji("party_popper")))) case "remove_organization": if currentAccessType == types.PermissionNamedEntities && len(currentAuthorizedEntities) == 0 { @@ -502,7 +502,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } organizations := strings.Split(accessFlags.organizations, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("Organization", "Organizations", len(organizations)), style.Emoji("firecracker")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize("Organization", "Organizations", len(organizations)), style.Emoji("firecracker")))) case "add_entities": if currentAccessType != types.PermissionNamedEntities { @@ -521,7 +521,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke } index++ namedEntityValList := strings.Split(namedEntityVal, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize(cases.Title(language.Und, cases.NoLower).String(strings.TrimSuffix(namedEntityType, "s")), cases.Title(language.Und, cases.NoLower).String(namedEntityType), len(namedEntityValList)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize(cases.Title(language.Und, cases.NoLower).String(strings.TrimSuffix(namedEntityType, "s")), cases.Title(language.Und, cases.NoLower).String(namedEntityType), len(namedEntityValList)), style.Emoji("party_popper")))) } } else { for namedEntityType, namedEntityVal := range namedEntitiesValMap() { @@ -530,7 +530,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke return err } namedEntityValList := strings.Split(namedEntityVal, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize(cases.Title(language.Und, cases.NoLower).String(strings.TrimSuffix(namedEntityType, "s")), cases.Title(language.Und, cases.NoLower).String(namedEntityType), len(namedEntityValList)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize(cases.Title(language.Und, cases.NoLower).String(strings.TrimSuffix(namedEntityType, "s")), cases.Title(language.Und, cases.NoLower).String(namedEntityType), len(namedEntityValList)), style.Emoji("party_popper")))) } } @@ -548,7 +548,7 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke return err } namedEntityValList := strings.Split(namedEntityVal, ",") - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize(cases.Title(language.Und, cases.NoLower).String(strings.TrimSuffix(namedEntityType, "s")), cases.Title(language.Und, cases.NoLower).String(namedEntityType), len(namedEntityValList)), style.Emoji("firecracker")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s removed %s", style.Pluralize(cases.Title(language.Und, cases.NoLower).String(strings.TrimSuffix(namedEntityType, "s")), cases.Title(language.Und, cases.NoLower).String(namedEntityType), len(namedEntityValList)), style.Emoji("firecracker")))) } } return nil @@ -775,6 +775,6 @@ func AddAppCollaboratorsToNamedEntities(ctx context.Context, clients *shared.Cli return err } - clients.IO.PrintInfo(ctx, false, style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("App collaborator", "App collaborators", len(collaborators)), style.Emoji("party_popper")))) + clients.IO.PrintInfo(ctx, false, "%s", style.Secondary(fmt.Sprintf("%s added %s", style.Pluralize("App collaborator", "App collaborators", len(collaborators)), style.Emoji("party_popper")))) return nil } diff --git a/cmd/triggers/create.go b/cmd/triggers/create.go index 4359ed29..dcaab6fc 100644 --- a/cmd/triggers/create.go +++ b/cmd/triggers/create.go @@ -243,7 +243,7 @@ func ListWorkflows( for callbackID := range slackYaml.Workflows { workflows = workflows + fmt.Sprintf("- #/workflows/%s\n", callbackID) } - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "bulb", Text: `The "workflow" property in the trigger definition file should be one of the following:`, Secondary: []string{ @@ -252,7 +252,7 @@ func ListWorkflows( }, })) } else { - clients.IO.PrintInfo(ctx, false, style.Sectionf(style.TextSection{ + clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ Emoji: "warning", Text: "Your app has no workflows", Secondary: []string{ diff --git a/cmd/triggers/generate.go b/cmd/triggers/generate.go index 459cf2ed..889234a7 100644 --- a/cmd/triggers/generate.go +++ b/cmd/triggers/generate.go @@ -188,18 +188,18 @@ func getFullyQualifiedTriggerFilePaths(ctx context.Context, clients *shared.Clie if isValidTriggerFilePath(file) { triggerFilePaths = append(triggerFilePaths, file) } else { - clients.IO.PrintDebug(ctx, fmt.Sprintf("Ignoring invalid trigger file path: %v", file)) + clients.IO.PrintDebug(ctx, "Ignoring invalid trigger file path: %v", file) } } } if len(triggerFilePaths) <= 0 { - clients.IO.PrintInfo(ctx, false, style.SectionSecondaryf( + clients.IO.PrintInfo(ctx, false, "%s", style.SectionSecondaryf( "No trigger definition files found\nLearn more about triggers:\nhttps://docs.slack.dev/tools/deno-slack-sdk/guides/creating-link-triggers", )) return nil, nil } else { - clients.IO.PrintInfo(ctx, false, style.SectionSecondaryf( + clients.IO.PrintInfo(ctx, false, "%s", style.SectionSecondaryf( "Found %d trigger definition %s", len(triggerFilePaths), style.Pluralize("file", "files", len(triggerFilePaths)), )) } diff --git a/cmd/triggers/triggers.go b/cmd/triggers/triggers.go index 4ef325df..c0b3bc69 100644 --- a/cmd/triggers/triggers.go +++ b/cmd/triggers/triggers.go @@ -403,7 +403,7 @@ func promptForTriggerID(ctx context.Context, cmd *cobra.Command, clients *shared func printNoTriggersMessage(ctx context.Context, IO iostreams.IOStreamer) { fmt.Println() - IO.PrintInfo(ctx, true, style.Sectionf(style.TextSection{ + IO.PrintInfo(ctx, true, "%s", style.Sectionf(style.TextSection{ Emoji: "zap", Text: "There are no triggers installed for this app", })) diff --git a/internal/api/debug.go b/internal/api/debug.go index 402de03f..4e7385a6 100644 --- a/internal/api/debug.go +++ b/internal/api/debug.go @@ -47,7 +47,7 @@ func (c *Client) printRequest(ctx context.Context, req *http.Request, skipDebugL output = strings.Join(outputLines, "\n") output = goutils.RedactPII(output) if !skipDebugLog { - c.io.PrintDebug(ctx, output) + c.io.PrintDebug(ctx, "%s", output) } } @@ -74,7 +74,7 @@ func (c *Client) printResponse(ctx context.Context, resp *http.Response, skipDeb output = goutils.RedactPII(output) if !skipDebugLog { - c.io.PrintDebug(ctx, output) + c.io.PrintDebug(ctx, "%s", output) } } diff --git a/internal/iostreams/writer.go b/internal/iostreams/writer.go index 6c9e710c..d434cf21 100644 --- a/internal/iostreams/writer.go +++ b/internal/iostreams/writer.go @@ -150,7 +150,7 @@ type WriteDebugger struct { func (wr WriteDebugger) Write(p []byte) (n int, err error) { lines := strings.Split(strings.TrimSpace(string(p)), "\n") for _, line := range lines { - wr.io.PrintDebug(wr.ctx, line) + wr.io.PrintDebug(wr.ctx, "%s", line) } return len(p), nil } diff --git a/internal/pkg/apps/install.go b/internal/pkg/apps/install.go index ba9ea229..7bfe922a 100644 --- a/internal/pkg/apps/install.go +++ b/internal/pkg/apps/install.go @@ -284,7 +284,7 @@ func printNonSuccessInstallState(ctx context.Context, clients *shared.ClientFact secondary, }, })) - clients.IO.PrintInfo(ctx, false, status) + clients.IO.PrintInfo(ctx, false, "%s", status) } func validateManifestForInstall(ctx context.Context, clients *shared.ClientFactory, token string, app types.App, appManifest types.AppManifest) error { @@ -859,7 +859,7 @@ func continueDespiteWarning(ctx context.Context, clients *shared.ClientFactory, } if foundBreakingChange { - clients.IO.PrintWarning(ctx, warn.Warning(clients.Config.DebugEnabled, "App manifest contains possible breaking changes")) + clients.IO.PrintWarning(ctx, "%s", warn.Warning(clients.Config.DebugEnabled, "App manifest contains possible breaking changes")) saveManifestDespiteWarning, err := clients.IO.ConfirmPrompt(ctx, "Confirm changes?", false) if err != nil { return false, err @@ -879,7 +879,7 @@ func continueDespiteWarning(ctx context.Context, clients *shared.ClientFactory, return false, nil } - clients.IO.PrintWarning(ctx, warn.Warning(clients.Config.DebugEnabled, additionalManifestInfoNotice)) + clients.IO.PrintWarning(ctx, "%s", warn.Warning(clients.Config.DebugEnabled, additionalManifestInfoNotice)) return true, nil } @@ -891,7 +891,7 @@ func setAppEnvironmentTokens(ctx context.Context, clients *shared.ClientFactory, return err } } else if token != result.APIAccessTokens.AppLevel { - clients.IO.PrintWarning(ctx, style.Sectionf(style.TextSection{ + clients.IO.PrintWarning(ctx, "%s", style.Sectionf(style.TextSection{ Text: fmt.Sprintf("The app token differs from the set %s environment variable", style.Highlight("SLACK_APP_TOKEN")), Secondary: []string{ "The environment variable will continue to be used", @@ -904,7 +904,7 @@ func setAppEnvironmentTokens(ctx context.Context, clients *shared.ClientFactory, return err } } else if token != result.APIAccessTokens.Bot { - clients.IO.PrintWarning(ctx, style.Sectionf(style.TextSection{ + clients.IO.PrintWarning(ctx, "%s", style.Sectionf(style.TextSection{ Text: fmt.Sprintf("The bot token differs from the set %s environment variable", style.Highlight("SLACK_BOT_TOKEN")), Secondary: []string{ "The environment variable will continue to be used", diff --git a/internal/pkg/create/create.go b/internal/pkg/create/create.go index 6e37f41b..f3de3933 100644 --- a/internal/pkg/create/create.go +++ b/internal/pkg/create/create.go @@ -100,12 +100,12 @@ func Create(ctx context.Context, clients *shared.ClientFactory, log *logger.Logg // and debugs and the standard output here clients.IO.PrintTrace(ctx, slacktrace.CreateStart) clients.IO.PrintTrace(ctx, slacktrace.CreateProjectPath, projectDirPath) - clients.IO.PrintDebug(ctx, fmt.Sprintf("creating a new project called '%s'", appDirName)) - clients.IO.PrintDebug(ctx, fmt.Sprintf("cloning project from template '%s'", createArgs.Template.path)) + clients.IO.PrintDebug(ctx, "creating a new project called '%s'", appDirName) + clients.IO.PrintDebug(ctx, "cloning project from template '%s'", createArgs.Template.path) if createArgs.GitBranch != "" { - clients.IO.PrintDebug(ctx, fmt.Sprintf("cloning project from branch '%s'", createArgs.GitBranch)) + clients.IO.PrintDebug(ctx, "cloning project from branch '%s'", createArgs.GitBranch) } - clients.IO.PrintDebug(ctx, fmt.Sprintf("writing project to path '%s'", projectDirPath)) + clients.IO.PrintDebug(ctx, "writing project to path '%s'", projectDirPath) projectDetails := []string{ fmt.Sprintf("Cloning template %s", style.Highlight(createArgs.Template.GetTemplatePath())), } @@ -375,7 +375,7 @@ func InstallProjectDependencies( if err := clients.InitRuntime(ctx, projectDirPath); err != nil { clients.IO.PrintDebug(ctx, "Error detecting the runtime of the project: %s", err) } else { - clients.IO.PrintDebug(ctx, fmt.Sprintf("Detected a project using %s", style.Highlight(clients.Runtime.Name()))) + clients.IO.PrintDebug(ctx, "Detected a project using %s", style.Highlight(clients.Runtime.Name())) } // Create a .slack directory diff --git a/internal/pkg/manifest/validate.go b/internal/pkg/manifest/validate.go index c937e8af..50d04109 100644 --- a/internal/pkg/manifest/validate.go +++ b/internal/pkg/manifest/validate.go @@ -131,7 +131,7 @@ func attemptConnectorAppsApprovalRequests(ctx context.Context, clients *shared.C Text: "Administrator approval is required to use connectors", Secondary: messages, })) - clients.IO.PrintInfo(ctx, false, administratorApprovalNotice) + clients.IO.PrintInfo(ctx, false, "%s", administratorApprovalNotice) sendApprovalRequests, err := clients.IO.ConfirmPrompt(ctx, "Request approval to install missing connectors?", true) if err != nil { diff --git a/internal/pkg/platform/activity.go b/internal/pkg/platform/activity.go index befefecf..b155c225 100644 --- a/internal/pkg/platform/activity.go +++ b/internal/pkg/platform/activity.go @@ -155,7 +155,7 @@ func printLatestActivity(ctx context.Context, clients *shared.ClientFactory, tok latestTimestamp = activity.Created } - clients.IO.PrintInfo(ctx, false, prettifyActivity(activity)) + clients.IO.PrintInfo(ctx, false, "%s", prettifyActivity(activity)) } return latestTimestamp, len(result.Activities), nil diff --git a/internal/prompts/app_select.go b/internal/prompts/app_select.go index 9593474d..9fe01313 100644 --- a/internal/prompts/app_select.go +++ b/internal/prompts/app_select.go @@ -763,7 +763,7 @@ func OrgSelectWorkspacePrompt(ctx context.Context, clients *shared.ClientFactory msg = fmt.Sprintf("%s %s\n", msg, style.Secondary("Workspace not listed? Use the `--org-workspace-grant=` flag")) } - clients.IO.PrintInfo(ctx, false, msg) + clients.IO.PrintInfo(ctx, false, "%s", msg) selection, err := clients.IO.SelectPrompt(ctx, "Choose a workspace to grant access:", teamDomains, iostreams.SelectPromptConfig{ PageSize: 4, Required: true, @@ -791,7 +791,7 @@ func ValidateGetOrgWorkspaceGrant(ctx context.Context, clients *shared.ClientFac // Not an org app; should not be setting the org workspace flag if !(newAppOrgAuth || types.IsEnterpriseTeamID(selection.App.TeamID)) && orgGrantWorkspaceID != "" { orgGrantWorkspaceID = "" - clients.IO.PrintDebug(ctx, fmt.Sprintf("--%s flag ignored for app that wasn't created on an org", cmdutil.OrgGrantWorkspaceFlag)) + clients.IO.PrintDebug(ctx, "--%s flag ignored for app that wasn't created on an org", cmdutil.OrgGrantWorkspaceFlag) } // Prevent user from adding grants for multiple org workspaces @@ -886,7 +886,7 @@ func validateAuth(ctx context.Context, clients *shared.ClientFactory, auth *type if unfilteredError != nil || !clients.IO.IsTTY() { return err } - clients.IO.PrintInfo(ctx, false, fmt.Sprintf("\n%sWhoops! Looks like your authentication may be expired or invalid", style.Emoji("lock"))) + clients.IO.PrintInfo(ctx, false, "\n%sWhoops! Looks like your authentication may be expired or invalid", style.Emoji("lock")) reauth, _, err := authpkg.Login(ctx, apiClient, clients.Auth(), clients.IO, "", false) if err != nil { return err diff --git a/internal/runtime/node/npm.go b/internal/runtime/node/npm.go index 63ba563a..9ef67ed3 100644 --- a/internal/runtime/node/npm.go +++ b/internal/runtime/node/npm.go @@ -63,7 +63,7 @@ func (n *NPMClient) InstallAllPackages(ctx context.Context, dirPath string, hook output := strings.TrimSpace(stdout.String()) if err != nil { - ios.PrintDebug(ctx, fmt.Sprintf("Error executing '%s': %s", hookScript.Command, err)) + ios.PrintDebug(ctx, "Error executing '%s': %s", hookScript.Command, err) return "", err } @@ -94,7 +94,7 @@ func (n *NPMClient) InstallDevPackage(ctx context.Context, pkgName string, dirPa output := strings.TrimSpace(stdout.String()) if err != nil { - ios.PrintDebug(ctx, fmt.Sprintf("Error executing '%s': %s", hookScript.Command, err)) + ios.PrintDebug(ctx, "Error executing '%s': %s", hookScript.Command, err) npmSpan.SetTag("error", output) return "", err } @@ -125,7 +125,7 @@ func (n *NPMClient) ListPackage(ctx context.Context, pkgName string, dirPath str output := strings.TrimSpace(stdout.String()) if err != nil { - ios.PrintDebug(ctx, fmt.Sprintf("Error executing '%s': %s", hookScript.Command, err)) + ios.PrintDebug(ctx, "Error executing '%s': %s", hookScript.Command, err) npmSpan.SetTag("error", output) return "", false } From 95e3ecf8f33903084102dac19578c75c06126f72 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 18 Feb 2026 20:43:39 -0800 Subject: [PATCH 3/3] test: verbose args --- internal/pkg/create/create_test.go | 13 +++++++++---- internal/runtime/node/npm_test.go | 12 ++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/internal/pkg/create/create_test.go b/internal/pkg/create/create_test.go index 67b8991d..aea33a21 100644 --- a/internal/pkg/create/create_test.go +++ b/internal/pkg/create/create_test.go @@ -25,6 +25,7 @@ import ( "github.com/slackapi/slack-cli/internal/shared" "github.com/slackapi/slack-cli/internal/slackcontext" "github.com/slackapi/slack-cli/internal/slackhttp" + "github.com/slackapi/slack-cli/internal/style" "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -192,6 +193,7 @@ func Test_Create_installProjectDependencies(t *testing.T) { expectedOutputs []string unexpectedOutputs []string expectedVerboseOutputs []string + expectedVerboseArgs []any }{ "Should output added .slack, hooks.json, .gitignore, and caching": { expectedOutputs: []string{ @@ -201,8 +203,9 @@ func Test_Create_installProjectDependencies(t *testing.T) { "Cached dependencies with deno cache import_map.json", }, expectedVerboseOutputs: []string{ - "Detected a project using Deno", + "Detected a project using %s", }, + expectedVerboseArgs: []any{style.Highlight("Deno")}, }, "When hooks.json exists, should output found .slack and hooks.json": { existingFiles: map[string]string{ @@ -218,8 +221,9 @@ func Test_Create_installProjectDependencies(t *testing.T) { "Error adding the directory project-name/.slack", }, expectedVerboseOutputs: []string{ - "Detected a project using Deno", + "Detected a project using %s", }, + expectedVerboseArgs: []any{style.Highlight("Deno")}, }, "When slack.json exists, should output added .slack": { existingFiles: map[string]string{ @@ -231,8 +235,9 @@ func Test_Create_installProjectDependencies(t *testing.T) { "Cached dependencies with deno cache import_map.json", }, expectedVerboseOutputs: []string{ - "Detected a project using Deno", + "Detected a project using %s", }, + expectedVerboseArgs: []any{style.Highlight("Deno")}, }, "When no manifest source, default to project (local)": { expectedOutputs: []string{ @@ -321,7 +326,7 @@ func Test_Create_installProjectDependencies(t *testing.T) { require.NotContains(t, outputs, unexpectedOutput) } for _, expectedVerboseOutput := range tc.expectedVerboseOutputs { - clientsMock.IO.AssertCalled(t, "PrintDebug", mock.Anything, expectedVerboseOutput, mock.MatchedBy(func(args ...any) bool { return true })) + clientsMock.IO.AssertCalled(t, "PrintDebug", mock.Anything, expectedVerboseOutput, tc.expectedVerboseArgs) } assert.NotEmpty(t, clients.Config.ProjectID, "config.project_id") // output := clientsMock.GetCombinedOutput() diff --git a/internal/runtime/node/npm_test.go b/internal/runtime/node/npm_test.go index 4ffbcca2..337ed0ff 100644 --- a/internal/runtime/node/npm_test.go +++ b/internal/runtime/node/npm_test.go @@ -35,6 +35,7 @@ func Test_NPMClient_InstallAllPackages(t *testing.T) { hookExecuteResponse string hookExecuteError error expectedVerboseOutput string + expectedVerboseArgs []any expectedValue string expectedError error }{ @@ -53,7 +54,8 @@ func Test_NPMClient_InstallAllPackages(t *testing.T) { "When error then PrintDebug": { hookExecuteStdout: "npm install stdout", hookExecuteError: errors.New("super error"), - expectedVerboseOutput: "Error executing 'npm install --no-package-lock --no-audit --progress=false --loglevel=verbose .': super error", + expectedVerboseOutput: "Error executing '%s': %s", + expectedVerboseArgs: []any{"npm install --no-package-lock --no-audit --progress=false --loglevel=verbose .", errors.New("super error")}, expectedValue: "", expectedError: errors.New("super error"), }, @@ -89,7 +91,7 @@ func Test_NPMClient_InstallAllPackages(t *testing.T) { require.Contains(t, value, tc.expectedValue) require.Equal(t, tc.expectedError, err) if tc.expectedVerboseOutput != "" { - ios.AssertCalled(t, "PrintDebug", mock.Anything, tc.expectedVerboseOutput, mock.MatchedBy(func(args ...any) bool { return true })) + ios.AssertCalled(t, "PrintDebug", mock.Anything, tc.expectedVerboseOutput, tc.expectedVerboseArgs) } }) } @@ -102,6 +104,7 @@ func Test_NPMClient_InstallDevPackage(t *testing.T) { hookExecuteResponse string hookExecuteError error expectedVerboseOutput string + expectedVerboseArgs []any expectedValue string expectedError error }{ @@ -120,7 +123,8 @@ func Test_NPMClient_InstallDevPackage(t *testing.T) { "When error then PrintDebug": { hookExecuteStdout: "npm install stdout", hookExecuteError: errors.New("super error"), - expectedVerboseOutput: "Error executing 'npm install --save-dev --no-audit --progress=false --loglevel=verbose @slack/cli-hooks': super error", + expectedVerboseOutput: "Error executing '%s': %s", + expectedVerboseArgs: []any{"npm install --save-dev --no-audit --progress=false --loglevel=verbose @slack/cli-hooks", errors.New("super error")}, expectedValue: "", expectedError: errors.New("super error"), }, @@ -156,7 +160,7 @@ func Test_NPMClient_InstallDevPackage(t *testing.T) { require.Contains(t, value, tc.expectedValue) require.Equal(t, tc.expectedError, err) if tc.expectedVerboseOutput != "" { - ios.AssertCalled(t, "PrintDebug", mock.Anything, tc.expectedVerboseOutput, mock.MatchedBy(func(args ...any) bool { return true })) + ios.AssertCalled(t, "PrintDebug", mock.Anything, tc.expectedVerboseOutput, tc.expectedVerboseArgs) } }) }