package common

type NetString []byte

// implement encoding.TextMarshaller interface to treat []byte as raw string
// by other encoders/serializers (e.g. JSON)

func (n NetString) MarshalText() ([]byte, error) {
	return n, nil
}

package common

// NetString store the byte length of the data that follows, making it easier
// to unambiguously pass text and byte data between programs that could be
// sensitive to values that could be interpreted as delimiters or terminators
// (such as a null character).
type NetString []byte

// MarshalText exists to implement encoding.TextMarshaller interface to
// treat []byte as raw string by other encoders/serializers (e.g. JSON)
func (n NetString) MarshalText() ([]byte, error) {
	return n, nil
}

Document NetString & MarshalText interface
Document NetString & MarshalText interface

This adds GoLint documentation that explains what a netstring is and why the MarshalText function exists.