MM-28765: Fix errcheck issues in server/channels/manualtesting/manual_testing.go (#30613)
1. Fixed hasher.Write() to check error return 2. Fixed VerifyEmail() to check error return 3. Fixed SaveMember() to check error return 4. Added typecheck exclusion for testAutoLink in .golangci.yml 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
354d7aeb72
Коммит
a6492b5b9f
@@ -119,7 +119,6 @@ issues:
|
|||||||
channels/jobs/helper_test.go|\
|
channels/jobs/helper_test.go|\
|
||||||
channels/jobs/hosted_purchase_screening/worker.go|\
|
channels/jobs/hosted_purchase_screening/worker.go|\
|
||||||
channels/jobs/jobs.go|\
|
channels/jobs/jobs.go|\
|
||||||
channels/manualtesting/manual_testing.go|\
|
|
||||||
channels/store/localcachelayer/channel_layer.go|\
|
channels/store/localcachelayer/channel_layer.go|\
|
||||||
channels/store/localcachelayer/channel_layer_test.go|\
|
channels/store/localcachelayer/channel_layer_test.go|\
|
||||||
channels/store/localcachelayer/emoji_layer.go|\
|
channels/store/localcachelayer/emoji_layer.go|\
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ func ManualTest(c *web.Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
uid, ok := params["uid"]
|
uid, ok := params["uid"]
|
||||||
if ok {
|
if ok {
|
||||||
hasher := fnv.New32a()
|
hasher := fnv.New32a()
|
||||||
hasher.Write([]byte(uid[0] + strconv.Itoa(int(time.Now().UTC().UnixNano()))))
|
_, writeErr := hasher.Write([]byte(uid[0] + strconv.Itoa(int(time.Now().UTC().UnixNano()))))
|
||||||
|
if writeErr != nil {
|
||||||
|
c.Logger.Error("Failed to write to hasher", mlog.Err(writeErr))
|
||||||
|
}
|
||||||
hash := hasher.Sum32()
|
hash := hasher.Sum32()
|
||||||
rand.Seed(int64(hash))
|
rand.Seed(int64(hash))
|
||||||
} else {
|
} else {
|
||||||
@@ -115,8 +118,15 @@ func ManualTest(c *web.Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.App.Srv().Store().User().VerifyEmail(user.Id, user.Email)
|
if _, verifyErr := c.App.Srv().Store().User().VerifyEmail(user.Id, user.Email); verifyErr != nil {
|
||||||
c.App.Srv().Store().Team().SaveMember(c.AppContext, &model.TeamMember{TeamId: teamID, UserId: user.Id}, *c.App.Config().TeamSettings.MaxUsersPerTeam)
|
c.Err = model.NewAppError("manualTest", "app.user.verify_email.app_error", nil, "", http.StatusInternalServerError).Wrap(verifyErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, saveErr := c.App.Srv().Store().Team().SaveMember(c.AppContext, &model.TeamMember{TeamId: teamID, UserId: user.Id}, *c.App.Config().TeamSettings.MaxUsersPerTeam); saveErr != nil {
|
||||||
|
c.Err = model.NewAppError("manualTest", "app.team.save_member.save.app_error", nil, "", http.StatusInternalServerError).Wrap(saveErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
userID = user.Id
|
userID = user.Id
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user