Skip to content

Commit 0c58ff9

Browse files
committed
gosec
1 parent 66647bd commit 0c58ff9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

coderd/workspaceapps.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,15 @@ func (api *API) postWorkspaceAppHealths(rw http.ResponseWriter, r *http.Request)
275275

276276
var newApps []database.WorkspaceApp
277277
for name, health := range req.Healths {
278-
var found *database.WorkspaceApp
279-
for _, app := range apps {
280-
if app.Name == name {
281-
found = &app
278+
found := func() *database.WorkspaceApp {
279+
for _, app := range apps {
280+
if app.Name == name {
281+
return &app
282+
}
282283
}
283-
}
284+
285+
return nil
286+
}()
284287
if found == nil {
285288
httpapi.Write(rw, http.StatusNotFound, codersdk.Response{
286289
Message: "Error setting workspace app health",

0 commit comments

Comments
 (0)