Whatever you are trying to do, it will mostly be faster, reliable, secure and maintainable if you just write the code in your application itself, or may be import it as a library/dependency. Compiling code on the go isn't a good idea, unless you are trying to make something like "Go playground".
While it may be effectively impossible, I too would like to do this, so I don't really get the hostility to the question (and this was my first Google hit looking into the possibility). My use-case is to embed a "go playground" in a standalone application that would run places where the go tool might not be installed.
Unfortunately I think using exec.Command is your best bet to harness the tools written by the Go community in order to compile your go programs within a go program.
gotool is how you compile Go code.gotool might not be installed.