Commit 44e4538

Richard Luby <richluby@gmail.com>
2016-12-06 15:31:46
added simple check for csv
added check for csv extension to preclude attempting to load incorrect type of file
1 parent 605f0c8
Changed files (1)
question.go
@@ -54,6 +54,9 @@ func parseLine(line string) error {
 // Lines starting with '#' are ignored
 func LoadFile(file *os.File) error {
 	log.Printf("Loading file: %+v", file.Name())
+	if !strings.HasSuffix(file.Name(), ".csv") {
+		return nil
+	}
 	scanner := bufio.NewScanner(file)
 	for scanner.Scan() {
 		if err := parseLine(scanner.Text()); err != nil {