|
@@ -12,7 +12,23 @@ C library to parse and generate YAML data quickly and reliably.
|
|
|
Compatibility
|
|
Compatibility
|
|
|
-------------
|
|
-------------
|
|
|
|
|
|
|
|
-The yaml package supports most of YAML 1.1 and 1.2, including support for
|
|
|
|
|
|
|
+The yaml package supports most of YAML 1.2, but preserves some behavior
|
|
|
|
|
+from 1.1 for backwards compatibility.
|
|
|
|
|
+
|
|
|
|
|
+Specifically, as of v3 of the yaml package:
|
|
|
|
|
+
|
|
|
|
|
+ - YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being
|
|
|
|
|
+ decoded into a typed bool value. Otherwise they behave as a string. Booleans
|
|
|
|
|
+ in YAML 1.2 are _true/false_ only.
|
|
|
|
|
+ - Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_
|
|
|
|
|
+ as specified in YAML 1.2, because most parsers still use the old format.
|
|
|
|
|
+ Octals in the _0o777_ format are supported though, so new files work.
|
|
|
|
|
+ - Does not support base-60 floats. These are gone from YAML 1.2, and were
|
|
|
|
|
+ actually never supported by this package as it's clearly a poor choice.
|
|
|
|
|
+
|
|
|
|
|
+and offers backwards
|
|
|
|
|
+compatibility with YAML 1.1 in some cases.
|
|
|
|
|
+1.2, including support for
|
|
|
anchors, tags, map merging, etc. Multi-document unmarshalling is not yet
|
|
anchors, tags, map merging, etc. Multi-document unmarshalling is not yet
|
|
|
implemented, and base-60 floats from YAML 1.1 are purposefully not
|
|
implemented, and base-60 floats from YAML 1.1 are purposefully not
|
|
|
supported since they're a poor design and are gone in YAML 1.2.
|
|
supported since they're a poor design and are gone in YAML 1.2.
|
|
@@ -20,29 +36,30 @@ supported since they're a poor design and are gone in YAML 1.2.
|
|
|
Installation and usage
|
|
Installation and usage
|
|
|
----------------------
|
|
----------------------
|
|
|
|
|
|
|
|
-The import path for the package is *gopkg.in/yaml.v2*.
|
|
|
|
|
|
|
+The import path for the package is *gopkg.in/yaml.v3*.
|
|
|
|
|
|
|
|
To install it, run:
|
|
To install it, run:
|
|
|
|
|
|
|
|
- go get gopkg.in/yaml.v2
|
|
|
|
|
|
|
+ go get gopkg.in/yaml.v3
|
|
|
|
|
|
|
|
API documentation
|
|
API documentation
|
|
|
-----------------
|
|
-----------------
|
|
|
|
|
|
|
|
If opened in a browser, the import path itself leads to the API documentation:
|
|
If opened in a browser, the import path itself leads to the API documentation:
|
|
|
|
|
|
|
|
- * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2)
|
|
|
|
|
|
|
+ - [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3)
|
|
|
|
|
|
|
|
API stability
|
|
API stability
|
|
|
-------------
|
|
-------------
|
|
|
|
|
|
|
|
-The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in).
|
|
|
|
|
|
|
+The package API for yaml v3 will remain stable as described in [gopkg.in](https://gopkg.in).
|
|
|
|
|
|
|
|
|
|
|
|
|
License
|
|
License
|
|
|
-------
|
|
-------
|
|
|
|
|
|
|
|
-The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details.
|
|
|
|
|
|
|
+The yaml package is licensed under the MIT and Apache License 2.0 licenses.
|
|
|
|
|
+Please see the LICENSE file for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
|
|
Example
|
|
@@ -55,7 +72,7 @@ import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"log"
|
|
"log"
|
|
|
|
|
|
|
|
- "gopkg.in/yaml.v2"
|
|
|
|
|
|
|
+ "gopkg.in/yaml.v3"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
var data = `
|
|
var data = `
|