Reputation: 123
I need to compile programs within golang in golang. Is there any native form without using exec.Command("go","build") ?
Upvotes: 2
Views: 1819
Reputation: 1327
You can try this
First set the $GOPATH
then set the $GOBIN
after that you can run go build or go get..
Upvotes: 0
Reputation: 136
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.
Upvotes: 3