Summary
In this chapter, we studied various methodologies for easing the debugging process such as coding incrementally and testing the code often, writing unit tests, handling all errors, and performing logging on the code.
Looking at the fmt
package, we discovered various ways to output information to help us to find bugs. The fmt
package offered different print formatting, verbs, and ways to control the output of the verbs by use of various flags.
With the usage of logging from Go's standard library, we were able to see details of how our application is executing. The log package allowed us to see the file path and line number that the log event took place on. The log package came with various print functions that mimic some of the fmt
print functions, which provided us with various insights into the usage of the verbs we learned in this chapter. We were also able to save the logging information to a file. Each time we call a print function from the log package, it placed...