Skip to content

Commit

Permalink
chore: unnecessary use of fmt.Sprintf (#3986)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored Jan 11, 2024
1 parent e97ac95 commit 752410b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/kots/cli/admin-console-upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func AdminConsoleUpgradeCmd() *cobra.Command {

if v.GetBool("force-upgrade-kurl") {
prompt := promptui.Prompt{
Label: fmt.Sprintf("Upgrading a kotsadm instance created by kURL can result in data loss. Do you want to continue"),
Label: "Upgrading a kotsadm instance created by kURL can result in data loss. Do you want to continue",
IsConfirm: true,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (h *Handler) DeployAppVersion(w http.ResponseWriter, r *http.Request) {

deployedSequence, err := store.GetStore().GetCurrentParentSequence(a.ID, downstreams[0].ClusterID)
if err != nil {
errMsg := fmt.Sprintf("failed to get deployed sequence")
errMsg := "failed to get deployed sequence"
logger.Error(errors.Wrap(err, errMsg))
deployAppVersionResponse.Error = errMsg
JSON(w, http.StatusInternalServerError, deployAppVersionResponse)
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/troubleshoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (h *Handler) GetSupportBundleCommand(w http.ResponseWriter, r *http.Request

response.Command = []string{
"curl https://krew.sh/support-bundle | bash",
fmt.Sprintf("kubectl support-bundle --load-cluster-specs"),
"kubectl support-bundle --load-cluster-specs",
}

opts := types.TroubleshootOptions{
Expand All @@ -263,7 +263,7 @@ func (h *Handler) GetSupportBundleCommand(w http.ResponseWriter, r *http.Request

response.Command = []string{
"curl https://krew.sh/support-bundle | bash",
fmt.Sprintf("kubectl support-bundle --load-cluster-specs"),
"kubectl support-bundle --load-cluster-specs",
}

foundApp, err := store.GetStore().GetAppFromSlug(appSlug)
Expand Down
6 changes: 3 additions & 3 deletions pkg/kotsadm/push_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func PushAppImagesFromTempRegistry(airgapRootDir string, imageList []string, opt
if options.LogForUI {
wc := reportWriterWithProgress(imageInfos, options.ProgressWriter)
reportWriter = wc.(io.Writer)
defer wc.Write([]byte(fmt.Sprintf("+status.flush:\n")))
defer wc.Write([]byte("+status.flush:\n"))
defer wc.Close()
}

Expand Down Expand Up @@ -413,7 +413,7 @@ func PushAppImagesFromDockerArchivePath(airgapRootDir string, options types.Push
if options.LogForUI {
wc := reportWriterWithProgress(imageInfos, options.ProgressWriter)
reportWriter = wc.(io.Writer)
defer wc.Write([]byte(fmt.Sprintf("+status.flush:\n")))
defer wc.Write([]byte("+status.flush:\n"))
defer wc.Close()
}

Expand Down Expand Up @@ -489,7 +489,7 @@ func PushAppImagesFromDockerArchiveBundle(airgapBundle string, options types.Pus
if options.LogForUI {
wc := reportWriterWithProgress(imageInfos, options.ProgressWriter)
reportWriter = wc.(io.Writer)
defer wc.Write([]byte(fmt.Sprintf("+status.flush:\n")))
defer wc.Write([]byte("+status.flush:\n"))
defer wc.Close()
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/version/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ spec:
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
archiveDir, err := ioutil.TempDir("", fmt.Sprintf("kotsadm"))
archiveDir, err := ioutil.TempDir("", "kotsadm")
req.NoError(err)
defer os.RemoveAll(archiveDir)
mockStore := tt.mockStoreFn(tt.app, tt.sequence, archiveDir, tt.files)
Expand Down

0 comments on commit 752410b

Please sign in to comment.