Use pointer instead of struct

This commit is contained in:
nemunaire 2021-03-07 12:39:38 +01:00
commit 6d8f38d749
18 changed files with 187 additions and 142 deletions

View file

@ -338,7 +338,7 @@ func receiveChallenge(r *http.Request, ps httprouter.Params, body []byte) (inter
return nil, errors.New("This is not the expected token.")
}
var std adlin.Student
var std *adlin.Student
if stdid, err := strconv.Atoi(gt.Login); err == nil {
if std, err = adlin.GetStudent(stdid); err != nil {
@ -388,7 +388,7 @@ func receiveToken(r *http.Request, body []byte, chid int) (interface{}, error) {
if std, err := adlin.GetStudentByLogin(gt.Login); err != nil {
return nil, err
} else {
if err := challenges[chid-1].Check(&std, &gt, chid); err != nil {
if err := challenges[chid-1].Check(std, &gt, chid); err != nil {
log.Printf("%s just try ch#%d: %s\n", std.Login, chid, err)
return nil, err
}