- What's the trade-off between text and binary encodings?
Text-based encodings are easier to read for a human, as well as easier to debug and write, but they take more space because of it. Binary encodings are difficult to write, read, and debug for a human, but smaller in size.
- How does Go behave with a data structure by default when encoding?
The default behavior of Go is to use reflection in order to read the fields and their values.
- How can this behavior be changed?
This behavior can be changed by implementing the marshaller interface of the encoding you are using, such as json.Marshaller for JSON.
- How does a structure field get encoded in an XML attribute?
The struct field needs to specify the ,attr value in its tag.
- What operation is required to decode a gob interface value?
The data types that implement the interface need to be registered in the gob package using the gob.Register function.
- What is the protocol buffer encoding?
The protocol buffer is an encoding protocol made by Google that uses a definition file for data structures and services. The file is used to generate data models, clients, and server stubs, leaving only the implementation of the server to the developer.