mirror of https://github.com/knative/func.git
feat: support FUNC_GO env in Host builder (#2877)
This commit is contained in:
parent
243059b25b
commit
ec66c1a496
|
|
@ -113,6 +113,16 @@ func getRunFunc(ctx context.Context, job *Job) (runFn func() error, err error) {
|
|||
}
|
||||
|
||||
func runGo(ctx context.Context, job *Job) (err error) {
|
||||
// TODO: long-term, the correct architecture is to not read env vars
|
||||
// from deep within a package, but rather to expose the setting as a
|
||||
// variable and leave interacting with the environment to main.
|
||||
// This is a shortcut used by many packages, however, so it will work for
|
||||
// now.
|
||||
gobin := os.Getenv("FUNC_GO") // Use if provided
|
||||
if gobin == "" {
|
||||
gobin = "go" // default to looking on PATH
|
||||
}
|
||||
|
||||
// BUILD
|
||||
// -----
|
||||
// TODO: extract the build command code from the OCI Container Builder
|
||||
|
|
@ -125,7 +135,7 @@ func runGo(ctx context.Context, job *Job) (err error) {
|
|||
if job.verbose {
|
||||
args = append(args, "-v")
|
||||
}
|
||||
cmd := exec.CommandContext(ctx, "go", args...)
|
||||
cmd := exec.CommandContext(ctx, gobin, args...)
|
||||
cmd.Dir = job.Dir()
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
|
@ -139,7 +149,8 @@ func runGo(ctx context.Context, job *Job) (err error) {
|
|||
if job.verbose {
|
||||
args = append(args, "-v")
|
||||
}
|
||||
cmd = exec.CommandContext(ctx, "go", args...)
|
||||
|
||||
cmd = exec.CommandContext(ctx, gobin, args...)
|
||||
cmd.Dir = job.Dir()
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
|
|
|||
Loading…
Reference in New Issue