Is it possible to call the Go compiler programmatically from within a Go binary without os.exec? I want to produce a binary and leave it on the filesystem, no linking required.

Written by
reddit
Link to Post

https://www.reddit.com/r/golang/comments/b06e7e/is_it_possible_to_call_the_go_compiler/ by 

Basically, what the title says. I am making an updater program that fetches code from a repo under certain conditions. I want to be able to compile the repo (all code within which is Go), drop the binary on the filesystem, terminate the old, running version of that repo’s binary, and launch the new one.

I can absolutely call os.exec and run the Go compiler that way, but I was wondering if there is a way to do this without spawning child processes.

submitted by /u/PM_ME_YOUR_REPO
[link] [comments]

Article Tags:
· ·
Article Categories:
reddit

Leave a Reply