Implement error handling and logging in Go

Beginner
Developer
Student
Azure

Understand how to handle errors and log helpful information in your Go programs.

Learning objectives

In this module, you'll learn about:

  • Go's approach to error handling.
  • Error handling strategies.
  • The log standard package for logging.
  • Logging frameworks.

Prerequisites

  • A Go environment that's ready to create applications. Ideally, you should have installed and configured Go locally and installed Visual Studio Code with the Go extension.
  • Ability to create and modify .go files.
  • Ability to run Go applications by using the terminal prompt.
  • Knowledge of basic data types, like string, int, and boolean.
  • Knowledge of how to write basic data control flows, like if and for statements.
  • Knowledge of how to write functions that have multiple return values.