whatisgithub

What is yaml?

mikefarah/yaml — explained in plain English

Analysis updated 2026-07-31 · repo last pushed 2021-05-14

2Audience · developerComplexity · 2/5DormantLicenseSetup · easy

In one sentence

A Go library that reads and writes YAML configuration files. It converts YAML text into Go data structures and back, making it easy for Go apps to handle config files.

Mindmap

mindmap
  root((repo))
    What it does
      Reads YAML files
      Writes YAML files
      Converts to Go structs
      Supports generic maps
    Tech stack
      Go
      libyaml port
    Use cases
      Load config files
      Parse infrastructure templates
      Export human-readable data
    Audience
      Go developers
      DevOps tool builders
    History
      Built at Canonical
      Used in Juju project

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a Go deployment tool that reads user-defined environment settings from YAML config files.

USE CASE 2

Parse infrastructure-as-code templates in a Go application to extract configuration values.

USE CASE 3

Export application data as human-readable YAML files from Go programs.

USE CASE 4

Read YAML files with unknown structure into generic maps for dynamic processing.

What is it built with?

GoYAML

How does it compare?

mikefarah/yaml0-bingwu-0/live-interpreter010zx00x1/faresnipe
Stars222
LanguagePythonPython
Last pushed2021-05-14
MaintenanceDormant
Setup difficultyeasymoderateeasy
Complexity2/52/52/5
Audiencedevelopergeneralgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Just run go get to add the package to your Go project, no external dependencies needed.

Open source license that allows free use including commercial purposes, as long as you keep the copyright notice.

So what is it?

The gopkg.in/yaml.v2 package gives programs written in the Go language a simple way to read and write YAML files. YAML is a popular text format for configuration files, it’s what you often see when editing settings for cloud services, CI pipelines, or app configs. This library lets a Go application take YAML text and turn it into structured data the program can work with, or do the reverse: take structured data and serialize it back into YAML text. At a high level, the library does two main jobs: “unmarshalling” (reading YAML text and converting it into Go’s native data structures like structs, maps, and lists) and “marshalling” (taking those Go data structures and writing them out as properly formatted YAML). You define a Go struct with fields that match your YAML keys, and the library handles the translation automatically. It also supports reading YAML into generic maps when you don’t know the structure in advance. This library would be used by Go developers building applications that need to load configuration files, parse infrastructure-as-code templates, or export data in a human-readable format. For example, if you’re writing a deployment tool in Go and want users to define their environments via a YAML config file, this is the piece that reads that file and hands your code the values. It was originally built at Canonical for their Juju orchestration project, so it has seen serious production use. The implementation is a pure Go port of libyaml, a well-established C library for parsing YAML. This means it avoids calling out to external C code, keeping deployment simpler. It supports most of YAML 1.1 and 1.2, including features like anchors and map merging, but deliberately skips base-60 floats from YAML 1.1, which the authors consider a flawed design. The API is promised to remain stable for the v2 line.

Copy-paste prompts

Prompt 1
Write a Go program that uses gopkg.in/yaml.v2 to read a YAML config file with server host, port, and timeout fields into a Go struct and print the values.
Prompt 2
Show me how to marshal a Go struct into YAML text using gopkg.in/yaml.v2 and write it to a file.
Prompt 3
Create a Go function that reads an arbitrary YAML file into a generic map using gopkg.in/yaml.v2 when I don't know the structure ahead of time.
Prompt 4
Help me set up a Go project that uses gopkg.in/yaml.v2 to handle YAML config files with anchors and map merging.

Frequently asked questions

What is yaml?

A Go library that reads and writes YAML configuration files. It converts YAML text into Go data structures and back, making it easy for Go apps to handle config files.

Is yaml actively maintained?

Dormant — no commits in 2+ years (last push 2021-05-14).

What license does yaml use?

Open source license that allows free use including commercial purposes, as long as you keep the copyright notice.

How hard is yaml to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is yaml for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.