Handling errors

There is a central thesis in some programming language theories that errors in most programs happen at the boundary. While there are many interpretations of this thesis (boundaries of what? Some scholars think it's at the boundaries of functions; some think it's at the boundaries of computation), what is certainly true from experience is that boundaries of I/O are where the most errors happen. Hence, we have to be extra careful when dealing with input and output.

For the purposes of ingesting the files, we define an errList type as follows:

type errList []errorfunc (err errList) Error() string {  var buf bytes.Buffer  fmt.Fprintf(&buf, "Errors Found:\n")  for _, e := range err {    fmt.Fprintf(&buf, "\t%v\n", e)  } return buf.String() ...

Get Go Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.