Search⌘ K

Testing the Go Package

Explore testing a Go package by building a command-line utility that manages user data in a Postgres database. Understand how to connect, add, update, and delete users using Go functions and structures to verify package functionality and database integration.

The postGo.go utility

In order to test the package, we must develop a command-line utility called postGo.go.

Note: Because postGo.go uses an external package, even if we develop that package, we should not forget to download the latest version of that external package using go get or go get -u.

Because postGo.go is used for testing purposes only, we hardcoded most of the data apart from the username of the user we put into ...