Skip to content

Instantly share code, notes, and snippets.

View adilw3nomad's full-sized avatar

adilw3nomad adilw3nomad

  • Somewhere
View GitHub Profile

2 Jun 2019 at 01:52


We finished the last post with three tasks to tackle:

  • Adding tests
  • Keeping track of the score
  • Adding a flag that allows the CSV file to be customised.

The priority is to add tests, as I’m a firm believer in the benefits of Test Driven Development, often abbreviated as TDD. In a nutshell, you write a test of some behaviour you want to implement. You then run the test, see it fail, and make the smallest possible change to make it pass. Once your test is green, it’s time to refactor. Thus it becomes a cycle; red green, refactor.

package main
import (
"encoding/csv"
"fmt"
"log"
"os"
)
func main() {
package main
import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
)
package main
import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
)
package main
import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
)
package main
import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
"strings"
)
package main
import (
"bufio"
"encoding/csv"
"fmt"
"io"
"log"
"os"
"strings"