You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Task in library/package mode, as an embedded task runner within a larger CLI application. I would like to be able to permanently and programmatically enable experiments (specifically Remote Taskfiles) so that the end user is unaware of it and does not need to explicitly set environment variables, whether in a file or at the command line. Is it possible to expose this option to the Executor? Or is there some undocumented way of doing this?
Thanks!
The text was updated successfully, but these errors were encountered:
Adding: the current implementation of reading experiments from the env during init() makes it extra challenging to override programmatically, since you can't manually set environment variables within a a running program before the init function runs, I.E.:
package main
import (
"context""os""github.com/go-task/task/v3""github.com/go-task/task/v3/taskfile/ast"
)
funcmain() {
os.Setenv("TASK_X_REMOTE_TASKFILES", "1") // too late; `experiments` has already been `init()`exe:=&task.Executor{
Dir: ".",
Force: false,
ForceAll: false,
Insecure: false,
Download: true,
Offline: false,
Watch: false,
Verbose: false,
Silent: true,
AssumeYes: false,
Dry: false,
Summary: false,
Parallel: false,
Color: true,
Stdin: os.Stdin,
Stdout: os.Stdout,
Stderr: os.Stderr,
}
// internally, here is where the value of `experiments.RemoteTaskfiles.Enabled` is accessed// but it was *read* before the start of `main()`err:=exe.Setup()
iferr!=nil {
os.Exit(1)
}
task:=&ast.Call{ Task: "foo" }
if_, err:=exe.GetTask(task); err!=nil {
os.Exit(2)
}
_=exe.Run(context.Background(), task)
}
Description
I am using Task in library/package mode, as an embedded task runner within a larger CLI application. I would like to be able to permanently and programmatically enable experiments (specifically Remote Taskfiles) so that the end user is unaware of it and does not need to explicitly set environment variables, whether in a file or at the command line. Is it possible to expose this option to the
Executor
? Or is there some undocumented way of doing this?Thanks!
The text was updated successfully, but these errors were encountered: