Skip to content

Commit

Permalink
Added deferred file close
Browse files Browse the repository at this point in the history
Removed unnecessary println
  • Loading branch information
schwartzm committed Jul 2, 2019
1 parent 61945f2 commit 1fe7542
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gol/gc/ex1_quizgame/quiz.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
defer in.Close()
r := csv.NewReader(in)
ques, err := r.ReadAll()
if err != nil {
Expand All @@ -46,7 +47,6 @@ func main() {
if err != nil {
log.Fatal("Cannot interpret CSV value %v for question %v.", v[1], v[0])
}
fmt.Printf("user: %v, real: %v\n", user_answer, real_answer)
if user_answer == real_answer {
correct = correct + 1
}
Expand Down
1 change: 1 addition & 0 deletions gol/gc/ex1_quizgame/quiz_timed.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
defer in.Close()
r := csv.NewReader(in)
ques, err := r.ReadAll()
if err != nil {
Expand Down

0 comments on commit 1fe7542

Please sign in to comment.