In Chapter 4, Simplifying RESTful Services with Popular Go Frameworks, we used a driver package called go-sqlite3 to work with SQLite3. In the same way, pq is a database driver package available for Go. We can install that library system-wide by using the go get command, as follows:
go get github.com/lib/pq
We can also use the dep tool to install this package. We'll use it in this example. Let's look at the steps for installation here:
- Create a new project directory called basicExample in GOPATH, as follows:
touch -p $GOPATH/src/github.com/git-user/chapter7/basicExample
- Now, traverse to the basicExample directory and use dep to install the pq package in the directory, like this: ...