Also check out multihash from the IPFS folks: https://github.com/multiformats/multihash
It's a more robust, well-specified, interoperable version of this concept.
Though it's probably overkill if you control both the consumer and producer side (i.e. don't need the interoperability) and are just looking to make hash upgrades smoother, in that case a simple version prefix like Go's approach described above has lower overhead.