Or you can use Go reflection package and generate the source code from it.
Of if wanting to do something like Assembly.Emit, generate the machine code directly with a little help from unsafe and syscall packages.
Depends pretty much on the actual use case.