12. Files and Systems
Activity 12.01: Parsing Bank Transaction Files
Solution:
All directories and files created should be inside your $GOPATH
.
- Create a
Chapter12/Activity12.01/
directory. - Inside
Chapter12/Activity12.01/
, create amain.go
file. - Add the following code to the
main.go
file:package main import ( "encoding/csv" "errors" "flag" "fmt" "io" "log" "os" "strconv" "strings" )
- Create budget category types for fuel, food, mortgage, repairs, insurance, utilities, and retirement:
type budgetCategory string const ( autoFuel budgetCategory = "fuel" food budgetCategory = "food" mortgage budgetCategory = "mortgage" repairs budgetCategory = "repairs"...