This was vital pre Go 1.8 but since then things have changed:
A RawMessage value now marshals the same as its pointer type.
https://go.dev/doc/go1.8
So the example failure in this comment actually works fine in newer Go versions:
// RawJSON is a reimplementation of json.RawMessage that supports being used as a value type
//
// For example:
//
// jsonBytes, _ := json.Marshal(struct{
// RawMessage json.RawMessage
// RawJSON RawJSON
// }{
// json.RawMessage(`"Hello"`),
// RawJSON(`"World"`),
// })
//
// Results in:
//
// {"RawMessage":"IkhlbGxvIg==","RawJSON":"World"}
//
// See https://play.golang.org/p/FzhKIJP8-I for a full example.
type RawJSON []byte
This was vital pre Go 1.8 but since then things have changed:
https://go.dev/doc/go1.8
So the example failure in this comment actually works fine in newer Go versions: