Write and test a program in Go
By using what you've learned about Go, write and test a complete program.
Learning objectives
In this module, you'll practice and learn about:
- How testing works in Go.
- How to wrap the core logic of a program into a package.
- How to expose the core logic through a Web API.
- How to write tests for your core logic package (by using test-driven development).
- How almost all concepts we've covered so far can work together.
Prerequisites
- A Go environment ready to create programs. Ideally, you should have installed and configured Go locally and installed Visual Studio Code with the Go extension.
- The ability to create and modify
.go
files. - The ability to run Go programs by using the terminal prompt.
- Knowledge of basic data types like
string
,int
, andboolean
. - Knowledge of how to write basic data control flows like
if
andfor
statements. - Knowledge of how to write functions.
- Knowledge of how to create structures and methods.
- Knowledge of how to use libraries like
net/http
.