Display is a debugging routine for displaying
structured data, but it’s not far short of being able to
encode or marshal arbitrary Go objects as messages in a
portable notation suitable for inter-process communication.
As we saw in Section 4.5, Go’s standard library supports a variety of formats, including JSON, XML, and ASN.1. Another notation that is still widely used is S-expressions, the syntax of Lisp. Unlike the other notations, S-expressions are not supported by the Go standard library, not least because they have no universally accepted definition, despite several attempts at standardization and the existence of many implementations.
In this section, we’ll define a package that encodes arbitrary ...