Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
krashanoff committed Mar 5, 2022
1 parent 1e867e3 commit 55b5a1e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion backend/grading/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ func Grade(id string, job Job, results chan<- Result) {
defer os.RemoveAll(dir)
studentWorkFilePath := path.Join(dir, "work.tar.gz")
tmpFile, _ := os.Create(studentWorkFilePath)
io.Copy(tmpFile, job.File)
defer tmpFile.Close()
if _, err := io.Copy(tmpFile, job.File); err != nil {
fmt.Println(err)
return
}

// Execute grading script driver.
cmd := exec.Command(job.Script, studentWorkFilePath)
Expand Down
4 changes: 3 additions & 1 deletion backend/handler/assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ func GetAssignment(cc echo.Context) error {
}
for ok := rows.Next(); ok; ok = rows.Next() {
id, owner, date, points := "", "", time.Time{}, float64(0)
rows.Scan(&id, &owner, &date, &points)
if err := rows.Scan(&id, &owner, &date, &points); err != nil {
c.Logger().Error(err)
}
submissions = append(submissions, struct {
ID string "json:\"id\""
OwnerUsername string "json:\"owner\""
Expand Down
4 changes: 3 additions & 1 deletion backend/handler/class.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func GetClass(cc echo.Context) error {
}
for ok := rows.Next(); ok; ok = rows.Next() {
id, name, dueDate, points := 0, "", time.Time{}, float64(0)
rows.Scan(&id, &name, &dueDate, &points)
if err := rows.Scan(&id, &name, &dueDate, &points); err != nil {
c.Logger().Error(err)
}
assignments = append(assignments, struct {
ID int "json:\"id\""
Name string "json:\"name\""
Expand Down
8 changes: 6 additions & 2 deletions backend/handler/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ func GetUser(cc echo.Context) error {
for ok := rows.Next(); ok; ok = rows.Next() {
id := 0
name := ""
rows.Scan(&id, &name)
if err := rows.Scan(&id, &name); err != nil {
c.Logger().Error(err)
}
response.Classes = append(response.Classes, struct {
ID int "json:\"id\""
Name string "json:\"name\""
Expand All @@ -182,7 +184,9 @@ func GetUser(cc echo.Context) error {
}
for ok := rows.Next(); ok; ok = rows.Next() {
id, class, name, dueDate, points := 0, 0, "", time.Time{}, float64(0)
rows.Scan(&id, &class, &name, &dueDate, &points)
if err := rows.Scan(&id, &class, &name, &dueDate, &points); err != nil {
c.Logger().Error(err)
}
response.Assignments = append(response.Assignments, struct {
ID int "json:\"id\""
Class int "json:\"class\""
Expand Down

0 comments on commit 55b5a1e

Please sign in to comment.