There’s also a rather good Go package with autogenerated FHIR models: https://github.com/samply/golang-fhir-models.
It includes a marshaler and unmarshaller.
I’ve used it in my own project, and it covers all my needs for the R4 protocol.