Skip to content

Commit af49211

Browse files
committed
fix non-constant format string in call to fmt.Errorf
1 parent 2cdc010 commit af49211

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
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/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/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

0 commit comments

Comments
 (0)