Skip to content

Commit

Permalink
fix: role errcheck issues (mattermost#28544)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
  • Loading branch information
RS-labhub and hanzei authored Oct 8, 2024
1 parent 1d431e7 commit 9d6adbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ issues:
channels/api4/preference_test.go|\
channels/api4/reaction_test.go|\
channels/api4/remote_cluster.go|\
channels/api4/role.go|\
channels/api4/role_test.go|\
channels/api4/saml.go|\
channels/api4/scheme.go|\
Expand Down
10 changes: 8 additions & 2 deletions server/channels/api4/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func getAllRoles(c *Context, w http.ResponseWriter, r *http.Request) {
return
}

w.Write(js)
if _, err := w.Write(js); err != nil {
c.Logger.Warn("Error while writing response", mlog.Err(err))
return
}
}

func getRole(c *Context, w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -119,7 +122,10 @@ func getRolesByNames(c *Context, w http.ResponseWriter, r *http.Request) {
return
}

w.Write(js)
if _, err := w.Write(js); err != nil {
c.Logger.Warn("Error while writing response", mlog.Err(err))
return
}
}

func patchRole(c *Context, w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 9d6adbf

Please sign in to comment.