Working with YAML

Let’s learn how to work with YAML files in Go.

External packages for YAML

In this lesson, we briefly discuss how to work with YAML files in Go. The Go standard library does not include support for YAML files, which means that we should look at external packages for YAML support. There exist three main Go packages that allow us to work with YAML:

Choosing one is a matter of personal preference. We are going to work with go-yaml in this lesson, using the code found in yaml.go file.

Coding example

Due to the use of Go modules, yaml.go is placed in /usercode/. Here’s the most important part of the code:

Get hands-on with 1400+ tech skills courses.