I'm writing a small go program. I expect it to be run on different OSes, so I was hoping to use go run rather than including the compiled file. The problem is it uses a package from outside the standard library. I don't want to rely on people having the package. I can get the package using
package main
import "os/exec"
func main() {
_ := exec.Command("go", "get","github.com/user/library").Run()
}
But by then it's too late to import it. I can see three solutions.
Make a wrapper script.
Cross-compile
Get the user to do it
But I'd really like to install it and then import, is there any way to do so?