This article is very misleading.
Olivier Lefevre

Olivier Lefevre Thanks for the feedback :-)

It’s important to note that the machine code can be obtained from any source. I can see that you want the process to involve compilation from Golang to machine code to happen at runtime. If you look at the approach carefully, you’ll see that it is possible to do that here.

I’ve used direct assembly instruction here, because JIT examples are generally explained with assembly code. However, you can compile a program in any language (make sure the machine code generated is Position-Independent-Code) and then link and load it into a slice and execute it using the same approach above. You can even share state between the two programs.

Like what you read? Give Sidhartha Mani a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.