Closed hanzei closed 1 month ago
Hi.. Can you assign this to me ? Can give it a shot.
Sure! Thanks for working on the issue @pradeepmurugesan :+1:
Great to see you again :wink:
Great to see you again 😉
Thanks.. Looking forward to make some contributions.. 🤞
At Mattermost, we are committed to maintaining a high standard of code quality, reliability, and security. To further enhance this, we are launching a community campaign to integrate the
errcheck
linter across the Mattermost codebase.This Help Wanted ticket is about fixing the linter issues reported by
errcheck
inchannels/api4/channel.go
.What is
errcheck
?errcheck
is a tool that automatically identifies places in Go code where errors are returned but not checked. In Go, error handling is a critical part of writing robust applications, and ignoring returned errors can lead to bugs, crashes, or unintended behaviour. By integratingerrcheck
into the codebase, we can ensure that error handling is consistently and properly managed across the project.Tasks
channels/api4/channel.go
from the exceptions list forerrcheck
inserver/.golangci.yml
.make golangci-lint
to get a list of all linter errors.make golangci-lint
again to ensure all errors are fixed.Okay, but what does "properly handling" mean?
In general, errors should be returned to the caller. Non critical errors should be loggged and function execution should continue. There are some exceptions to this rule, such as when the error is expected and should be ignored or when the error is handled in a different way. In such cases, a comment should be added to explain why the error is ignored.
In tests, errors should be checked using
require.NoError(t, err)
for errors of typeerror
orrequire.Nil(t, err)
for errors of type**model.AppError
. If an error is expected, it should be checked usingrequire.Error(t, err)
for errors of typeerror
orrequire.NotNil(t, err)
for errors of type**model.AppError
.Use
err
as the variable name for errors andappErr
for*model.AppError
. Avoid using variable names likeerr1
,err2
, etc. See [the Mattermost style guide>(https://developers.mattermost.com/contribute/more-info/server/style-guide/#error-variable-names) for more information.If you're interested, please comment here and come join our "Contributors" community channel on the Mattermost Community server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers Server" community channel. You can also reach out to @hanzei either on this ticket or on the Mattermost Community server.
For new contributors, please see our Developer's Guide.
JIRA: MM-60709