Skip to content

Commit 2d854f0

Browse files
committed
fix non-constant format string in call to fmt Format method
1 parent d30de6e commit 2d854f0

File tree

11 files changed

+24
-24
lines changed

11 files changed

+24
-24
lines changed

components/local-app/pkg/selfupdate/selfupdate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func DownloadManifest(ctx context.Context, baseURL string) (res *Manifest, err e
136136
defer resp.Body.Close()
137137

138138
if resp.StatusCode != http.StatusOK {
139-
return nil, fmt.Errorf(resp.Status)
139+
return nil, fmt.Errorf("%s", resp.Status)
140140
}
141141

142142
var mf Manifest

components/public-api-server/pkg/proxy/errors.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,41 +30,41 @@ func categorizeRPCError(err error) *connect.Error {
3030
if rpcErr := new(jsonrpc2.Error); errors.As(err, &rpcErr) {
3131
switch rpcErr.Code {
3232
case 400:
33-
return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf(rpcErr.Message))
33+
return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("%s", rpcErr.Message))
3434
// components/gitpod-protocol/src/messaging/error.ts
3535
case 401:
36-
return connect.NewError(connect.CodeUnauthenticated, fmt.Errorf(rpcErr.Message))
36+
return connect.NewError(connect.CodeUnauthenticated, fmt.Errorf("%s", rpcErr.Message))
3737
// components/gitpod-protocol/src/messaging/error.ts
3838
case 403:
39-
return connect.NewError(connect.CodePermissionDenied, fmt.Errorf(rpcErr.Message))
39+
return connect.NewError(connect.CodePermissionDenied, fmt.Errorf("%s", rpcErr.Message))
4040
// components/gitpod-protocol/src/messaging/error.ts
4141
case 404:
42-
return connect.NewError(connect.CodeNotFound, fmt.Errorf(rpcErr.Message))
42+
return connect.NewError(connect.CodeNotFound, fmt.Errorf("%s", rpcErr.Message))
4343
// components/gitpod-protocol/src/messaging/error.ts
4444
case 409:
45-
return connect.NewError(connect.CodeAlreadyExists, fmt.Errorf(rpcErr.Message))
45+
return connect.NewError(connect.CodeAlreadyExists, fmt.Errorf("%s", rpcErr.Message))
4646
case 412:
47-
return connect.NewError(connect.CodeFailedPrecondition, fmt.Errorf(rpcErr.Message))
47+
return connect.NewError(connect.CodeFailedPrecondition, fmt.Errorf("%s", rpcErr.Message))
4848
case 429:
49-
return connect.NewError(connect.CodeResourceExhausted, fmt.Errorf(rpcErr.Message))
49+
return connect.NewError(connect.CodeResourceExhausted, fmt.Errorf("%s", rpcErr.Message))
5050
case 470:
51-
return connect.NewError(connect.CodePermissionDenied, fmt.Errorf(rpcErr.Message))
51+
return connect.NewError(connect.CodePermissionDenied, fmt.Errorf("%s", rpcErr.Message))
5252
case -32603:
53-
return connect.NewError(connect.CodeInternal, fmt.Errorf(rpcErr.Message))
53+
return connect.NewError(connect.CodeInternal, fmt.Errorf("%s", rpcErr.Message))
5454
}
5555
// components/gitpod-protocol/src/messaging/error.ts - user errors
5656
if rpcErr.Code >= 400 && rpcErr.Code < 500 {
57-
return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf(rpcErr.Message))
57+
return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("%s", rpcErr.Message))
5858
}
59-
return connect.NewError(connect.CodeInternal, fmt.Errorf(rpcErr.Message))
59+
return connect.NewError(connect.CodeInternal, fmt.Errorf("%s", rpcErr.Message))
6060
}
6161

6262
if errors.Is(err, context.Canceled) {
63-
return connect.NewError(connect.CodeDeadlineExceeded, fmt.Errorf("Request timed out"))
63+
return connect.NewError(connect.CodeDeadlineExceeded, fmt.Errorf("%s", "Request timed out"))
6464
}
6565

6666
if handshakeErr := new(protocol.ErrBadHandshake); errors.As(err, &handshakeErr) {
67-
return connect.NewError(connect.CodeUnauthenticated, fmt.Errorf("Failed to establish caller identity"))
67+
return connect.NewError(connect.CodeUnauthenticated, fmt.Errorf("%s", "Failed to establish caller identity"))
6868
}
6969

7070
return connect.NewError(connect.CodeInternal, err)

components/supervisor/cmd/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var initCmd = &cobra.Command{
9292
if ignoreUnexpectedExitCode.Load() {
9393
return
9494
}
95-
log.WithError(fmt.Errorf(logs)).Fatal("supervisor run error with unexpected exit code")
95+
log.WithError(fmt.Errorf("%s", logs)).Fatal("supervisor run error with unexpected exit code")
9696
}
9797
}
9898
go func() {

components/ws-daemon/cmd/content-initializer/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626
err := content.RunInitializerChild(statsFd)
2727
if err != nil {
2828
errfd := os.NewFile(content.RUN_INITIALIZER_CHILD_ERROUT_FD, "errout")
29-
_, _ = fmt.Fprintf(errfd, err.Error())
29+
_, _ = fmt.Fprintf(errfd, "%s", err.Error())
3030

3131
os.Exit(content.FAIL_CONTENT_INITIALIZER_EXIT_CODE)
3232
}

components/ws-daemon/pkg/controller/housekeeping.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (h *Housekeeping) doHousekeeping(ctx context.Context) (errs []error) {
7070

7171
var err error
7272
if len(msgs) > 0 {
73-
err = fmt.Errorf(strings.Join(msgs, ". "))
73+
err = fmt.Errorf("%s", strings.Join(msgs, ". "))
7474
}
7575
tracing.FinishSpan(span, &err)
7676
}()

components/ws-manager-mk2/controllers/workspace_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ func (r *WorkspaceReconciler) deleteWorkspaceSecrets(ctx context.Context, ws *wo
527527
}
528528

529529
if len(errs) != 0 {
530-
return fmt.Errorf(strings.Join(errs, ":"))
530+
return fmt.Errorf("%s", strings.Join(errs, ":"))
531531
}
532532

533533
return nil

components/ws-manager-mk2/service/imagespec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (is *WorkspaceImageSpecProvider) GetImageSpec(ctx context.Context, req *reg
3232
return nil, status.Errorf(codes.NotFound, "not found")
3333
}
3434
if err != nil {
35-
return nil, status.Errorf(codes.Internal, err.Error())
35+
return nil, status.Errorf(codes.Internal, "%s", err.Error())
3636
}
3737

3838
return &regapi.GetImageSpecResponse{

components/ws-manager-mk2/service/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (wsm *WorkspaceManagerServer) StartWorkspace(ctx context.Context, req *wsma
195195
storage, err := class.Container.Limits.StorageQuantity()
196196
if err != nil {
197197
msg := fmt.Sprintf("workspace class %s has invalid storage quantity: %v", class.Name, err)
198-
return nil, status.Errorf(codes.InvalidArgument, msg)
198+
return nil, status.Errorf(codes.InvalidArgument, "%s", msg)
199199
}
200200

201201
annotations := make(map[string]string)
@@ -690,7 +690,7 @@ func (wsm *WorkspaceManagerServer) TakeSnapshot(ctx context.Context, req *wsmana
690690
}
691691

692692
if sso.Status.Error != "" {
693-
return true, fmt.Errorf(sso.Status.Error)
693+
return true, fmt.Errorf("%s", sso.Status.Error)
694694
}
695695

696696
if sso.Status.URL != "" {

components/ws-proxy/pkg/sshproxy/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func workspaceSSHUsername(ctx context.Context, workspaceIP string, workspacekitP
600600
}
601601

602602
if resp.StatusCode != http.StatusOK {
603-
return "", fmt.Errorf(fmt.Sprintf("unexpected status: %v (%v)", string(result), resp.StatusCode))
603+
return "", fmt.Errorf("unexpected status: %v (%v)", string(result), resp.StatusCode)
604604
}
605605

606606
return string(result), nil

install/installer/cmd/mirror_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var mirrorRepoCmd = &cobra.Command{
1616
Use: "repo",
1717
Short: "Get original image repo for this installer",
1818
RunE: func(cmd *cobra.Command, args []string) error {
19-
fmt.Printf(config.GitpodContainerRegistry)
19+
fmt.Print(config.GitpodContainerRegistry)
2020
return nil
2121
},
2222
}

install/installer/cmd/validate_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var validateClusterCmd = &cobra.Command{
8484
os.Exit(1)
8585
}
8686

87-
fmt.Printf(out)
87+
fmt.Print(out)
8888
return nil
8989
},
9090
}

0 commit comments

Comments
 (0)