Commit 523df1e

Richard Luby <richluby@gmail.com>
2016-10-26 11:24:05
reformatted code
structures can now be included in both the client and the server without duplication
1 parent fa7070b
question.go
@@ -9,12 +9,6 @@ import (
 	"strings"
 )
 
-type Record struct {
-	Question,
-	Answer,
-	Category string
-}
-
 // parseLine parses a csv line and returns a single record
 func parseLine(line string) (Record, error) {
 	var record Record
questioner.go
@@ -15,35 +15,6 @@ import (
 	"time"
 )
 
-// EXIT_CODES define exit error codes
-type EXIT_CODES struct {
-	BAD_CONFIG,
-	FILE_IO_ERROR,
-	NETWORK_IO_ERROR int
-}
-
-// EXIT_CODE declares exit codes
-var EXIT_CODE = EXIT_CODES{
-	BAD_CONFIG:       1,
-	FILE_IO_ERROR:    2,
-	NETWORK_IO_ERROR: 3}
-
-// CONFIG defines default for the server
-type CONFIG struct {
-	// LISTEN_ADDRESS defines the local address on which to listen
-	LISTEN_ADDRESS string
-	//LISTEN_PORT defines the the port on which to listen
-	LISTEN_PORT int
-	// PERMIT_BLANK_PASSWORD determines if a password should be provided with the user names
-	PERMIT_BLANK_PASSWORD bool
-	// PRIVATE_KEY defines the path to the server's private key for signing https connections
-	PRIVATE_KEY string
-	// USE_HTTPS determines if the server should use HTTPS
-	USE_HTTPS bool
-	// QUESTIONS contains the path to the questions directory
-	QUESTIONS string
-}
-
 // defaultConfig is used when no configuration file is given
 const defaultConfig = `
 LISTEN_ADDRESS = "127.0.0.1"
structures.go
@@ -0,0 +1,37 @@
+package main
+
+// EXIT_CODES define exit error codes
+type EXIT_CODES struct {
+	BAD_CONFIG,
+	FILE_IO_ERROR,
+	NETWORK_IO_ERROR int
+}
+
+// EXIT_CODE declares exit codes
+var EXIT_CODE = EXIT_CODES{
+	BAD_CONFIG:       1,
+	FILE_IO_ERROR:    2,
+	NETWORK_IO_ERROR: 3}
+
+// CONFIG defines default for the server
+type CONFIG struct {
+	// LISTEN_ADDRESS defines the local address on which to listen
+	LISTEN_ADDRESS string
+	//LISTEN_PORT defines the the port on which to listen
+	LISTEN_PORT int
+	// PERMIT_BLANK_PASSWORD determines if a password should be provided with the user names
+	PERMIT_BLANK_PASSWORD bool
+	// PRIVATE_KEY defines the path to the server's private key for signing https connections
+	PRIVATE_KEY string
+	// USE_HTTPS determines if the server should use HTTPS
+	USE_HTTPS bool
+	// QUESTIONS contains the path to the questions directory
+	QUESTIONS string
+}
+
+// Record stores information related to a single record
+type Record struct {
+	Question,
+	Answer,
+	Category string
+}