go-human is a Go library for struct to human-readable text encoding. This library is maintained by the Anexia R&D team.
The primary motivation behind creating go-human as the need for a human-readable text encoder for arbitrary Go objects which can be used as a drop-in replacement for Go's encoding/json encoder.
The idea arose during development of an internal project, which provides a CLI binary for management purposes of a larger overall system. Initially the CLI binary was intended as a tool for human interaction with said system, but it soon became clear that some operations would need to be automated. Due to this need the tool would need to be able to output JSON, as well as a human-readable representation of the information retrieved via the API it communicated with.
In order to minimize the code required to fulfill both of these requirements we created go-human and are now using a commandline flag which configures the output mode. Behind the scenes both the JSON and go-human encoders implement the same interface, which in turn allowed us to have a single switch in the application which affects all output generated by it.
The text format go-human generates is loosely based on YAML, but with the distinction that this format was never intended to be parsed by a machine.
Please note that the exact format is intentionally not defined formally and parsing of text generated by this library is strongly discouraged.
Examples can be found in the package documentation at godoc.org.
The corresponding code can be found in go-human's GitHub repository inside the example_test.go file.
With a correctly configured Go toolchain:
go get -u github.com/anexia-it/go-human
Issues in go-human are tracked using the corresponding GitHub project's issue tracker.
The current release is v1.0.0.
Changes to go-human are subject to semantic versioning.
The ChangeLog provides information on releases and changes.
go-human is licensed under the terms of the MIT license.