Skip to content

Commit 7b6c464

Browse files
committed
Ignore errors
1 parent bff451b commit 7b6c464

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

enterprise/cli/workspaceproxy.go

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -150,32 +150,30 @@ func (r *RootCmd) createProxy() *clibase.Cmd {
150150
}
151151

152152
func (r *RootCmd) listProxies() *clibase.Cmd {
153-
var (
154-
formatter = cliui.NewOutputFormatter(
155-
cliui.TableFormat([]codersdk.WorkspaceProxy{}, []string{"name", "url", "status status"}),
156-
cliui.JSONFormat(),
157-
cliui.ChangeFormatterData(cliui.TextFormat(), func(data any) (any, error) {
158-
resp, ok := data.([]codersdk.WorkspaceProxy)
159-
if !ok {
160-
return nil, xerrors.Errorf("unexpected type %T", data)
153+
formatter := cliui.NewOutputFormatter(
154+
cliui.TableFormat([]codersdk.WorkspaceProxy{}, []string{"name", "url", "status status"}),
155+
cliui.JSONFormat(),
156+
cliui.ChangeFormatterData(cliui.TextFormat(), func(data any) (any, error) {
157+
resp, ok := data.([]codersdk.WorkspaceProxy)
158+
if !ok {
159+
return nil, xerrors.Errorf("unexpected type %T", data)
160+
}
161+
var str strings.Builder
162+
_, _ = str.WriteString("Workspace Proxies:\n")
163+
sep := ""
164+
for i, proxy := range resp {
165+
_, _ = str.WriteString(sep)
166+
_, _ = str.WriteString(fmt.Sprintf("%d: %s %s %s", i, proxy.Name, proxy.URL, proxy.Status.Status))
167+
for _, errMsg := range proxy.Status.Report.Errors {
168+
_, _ = str.WriteString(color.RedString("\n\tErr: %s", errMsg))
161169
}
162-
var str strings.Builder
163-
str.WriteString("Workspace Proxies:\n")
164-
sep := ""
165-
for i, proxy := range resp {
166-
str.WriteString(sep)
167-
str.WriteString(fmt.Sprintf("%d: %s %s %s", i, proxy.Name, proxy.URL, proxy.Status.Status))
168-
for _, errMsg := range proxy.Status.Report.Errors {
169-
str.WriteString(color.RedString("\n\tErr: %s", errMsg))
170-
}
171-
for _, warnMsg := range proxy.Status.Report.Errors {
172-
str.WriteString(color.YellowString("\n\tWarn: %s", warnMsg))
173-
}
174-
sep = "\n"
170+
for _, warnMsg := range proxy.Status.Report.Errors {
171+
_, _ = str.WriteString(color.YellowString("\n\tWarn: %s", warnMsg))
175172
}
176-
return str.String(), nil
177-
}),
178-
)
173+
sep = "\n"
174+
}
175+
return str.String(), nil
176+
}),
179177
)
180178

181179
client := new(codersdk.Client)

0 commit comments

Comments
 (0)