@@ -113,6 +113,16 @@ func getRunFunc(ctx context.Context, job *Job) (runFn func() error, err error) {
113
113
}
114
114
115
115
func runGo (ctx context.Context , job * Job ) (err error ) {
116
+ // TODO: long-term, the correct architecture is to not read env vars
117
+ // from deep within a package, but rather to expose the setting as a
118
+ // variable and leave interacting with the environment to main.
119
+ // This is a shortcut used by many packages, however, so it will work for
120
+ // now.
121
+ gobin := os .Getenv ("FUNC_GO" ) // Use if provided
122
+ if gobin == "" {
123
+ gobin = "go" // default to looking on PATH
124
+ }
125
+
116
126
// BUILD
117
127
// -----
118
128
// TODO: extract the build command code from the OCI Container Builder
@@ -125,7 +135,7 @@ func runGo(ctx context.Context, job *Job) (err error) {
125
135
if job .verbose {
126
136
args = append (args , "-v" )
127
137
}
128
- cmd := exec .CommandContext (ctx , "go" , args ... )
138
+ cmd := exec .CommandContext (ctx , gobin , args ... )
129
139
cmd .Dir = job .Dir ()
130
140
cmd .Stdout = os .Stdout
131
141
cmd .Stderr = os .Stderr
@@ -139,7 +149,8 @@ func runGo(ctx context.Context, job *Job) (err error) {
139
149
if job .verbose {
140
150
args = append (args , "-v" )
141
151
}
142
- cmd = exec .CommandContext (ctx , "go" , args ... )
152
+
153
+ cmd = exec .CommandContext (ctx , gobin , args ... )
143
154
cmd .Dir = job .Dir ()
144
155
cmd .Stdout = os .Stdout
145
156
cmd .Stderr = os .Stderr
0 commit comments