brew install highlight
Now copy some code to your clipboard, followed by running:
pbpaste | highlight --syntax=go -O rtf | pbcopy
Note: don't 'copy' the above bash code, manually type it, otherwise you'll end up trying to syntax highlight the line of bash! lulz on me for doing exactly that 🤦
Now paste your clipboard into your Google doc.