The connections to the database in the driver implementation may be pooled, and it is possible that the connection pulled out of the pool is broken. This recipe will show how to verify if the connection is alive.
Validating the connection
Getting ready
Verify if Go is properly installed by calling the go version command in your Terminal. If the command fails, follow the Getting ready section in the first recipe of this chapter.
How to do it...
- Open the console and create the folder chapter08/recipe02.
- Navigate to the directory.
- Create the verify.go file with the following...