Commit 7312ff8

Richard Luby <richluby@gmail.com>
2016-12-02 11:10:37
server can read question references
server supports questions that come with a provided [optional] reference
1 parent 2510eef
corpus/permissions.csv
@@ -510,3 +510,4 @@ linux permissions: what is the numeric mode of -rwxrwxr--,774,linux_acl
 linux permissions: what is the numeric mode of -rwxrwxr-x,775,linux_acl
 linux permissions: what is the numeric mode of -rwxrwxrw-,776,linux_acl
 linux permissions: what is the numeric mode of -rwxrwxrwx,777,linux_acl
+What command sets the default permissions mask?,umask,linux_acl,http://www.computerhope.com/unix/uumask.htm
question.go
@@ -34,12 +34,15 @@ func parseLine(line string) error {
 		return nil
 	}
 	tokens := strings.Split(line, ",")
-	if len(tokens) != 3 {
+	if len(tokens) < 3 {
 		return fmt.Errorf("Unable to parse line for %s", line)
 	}
 	record.Question = strings.TrimSpace(tokens[0])
 	record.Answer = strings.TrimSpace(tokens[1])
 	category := strings.TrimSpace(strings.ToLower(tokens[2]))
+	if len(tokens) >= 4 {
+		record.Reference = strings.TrimSpace(tokens[3])
+	}
 	assignCategory(category, &record)
 	recordMap[category] = append(recordMap[category], record)
 	return nil
README.md
@@ -32,6 +32,6 @@ USE_HTTPS = false
 ![Screenshot of Client](media/questioner.png)
 
 ## CSV Format
-The `csv` files should consist of the fields `question,response,category`. The application reads
-the questions from either a file or recursively from a directory; the behavior depends on the option
-passed under `QUESTIONS` in the `conf` file.
+The `csv` files should consist of the fields `question,response,category,reference`. The `reference`
+is an optional field. The application reads the questions from either a file or recursively from
+a directory; the behavior depends on the option passed under `QUESTIONS` in the `conf` file.
structures.go
@@ -50,6 +50,7 @@ var EXIT_CODE = EXIT_CODES{
 // Record stores information related to a single record
 type Record struct {
 	Question,
+	Reference,
 	Answer string
 	Category,
 	ID int