From 327cb50aab6ffffc6cf3d165e979ddfc5c64ebb0 Mon Sep 17 00:00:00 2001 From: an Date: Sat, 21 Apr 2018 19:48:13 +0200 Subject: [PATCH] questions.go: make quiz questions file a parameter --- modules/quiz.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/quiz.go b/modules/quiz.go index 9d2cd44..8d58ef3 100644 --- a/modules/quiz.go +++ b/modules/quiz.go @@ -4,6 +4,7 @@ package modules import ( "bufio" + "flag" "fmt" "math/rand" "os" @@ -20,6 +21,7 @@ type quizQuestion struct { } var ( + quizQuestionsFile = flag.String("quiz_questions_file", "questions.txt", "quiz: questions file") quizCtrlCh = make(chan string, 1024) quizAnswerCh = make(chan *Message, 1024) quizQuestions []quizQuestion @@ -67,7 +69,7 @@ func quiz() { } func quizRun() { - quizQuestions = quizLoadQuestions("questions.txt") + quizQuestions = quizLoadQuestions(*quizQuestionsFile) ranklist := make(map[string]int) SayCh <- fmt.Sprintf("%s\nQuiz gestartet.", "*") for {