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
Task v3.35.1 sets the directory of included taskfiles to the directory where the taskfile lives. In task v3.34.1 the directory had to explicitly be set with dir when including the taskfile.
If this is the intended behavior, I likely misunderstand what the real-world use of dir would be when including taskfiles.
The taskfiles in the sub* directories print the same variables
With 3.34.1:
❯ go run github.com/go-task/task/v3/cmd/task@v3.34.1
root | ROOT_DIR = '/tmp.ylQuJeHdXa'
root | TASKFILE_DIR = '/tmp.ylQuJeHdXa'
sub with | ROOT_DIR = '/tmp.ylQuJeHdXa'
sub with | TASKFILE_DIR = '/tmp.ylQuJeHdXa/sub_with_dir'
sub without | ROOT_DIR = '/tmp.ylQuJeHdXa'
sub without | TASKFILE_DIR = '/tmp.ylQuJeHdXa'
With 3.35.1:
❯ go run github.com/go-task/task/v3/cmd/task@v3.35.1
root | ROOT_DIR = '/tmp.ylQuJeHdXa'
root | TASKFILE_DIR = '/tmp.ylQuJeHdXa'
sub with | ROOT_DIR = '/tmp.ylQuJeHdXa'
sub with | TASKFILE_DIR = '/tmp.ylQuJeHdXa/sub_with_dir'
sub without | ROOT_DIR = '/tmp.ylQuJeHdXa'
sub without | TASKFILE_DIR = '/tmp.ylQuJeHdXa/sub_without_dir'
Notice how the TASKFILE_DIR variable is different for the taskfile included from sub_with_dir and with dir set.
Task version: 3.34.1 vs 3.35.1
Operating system: macOS 14.2
The text was updated successfully, but these errors were encountered:
@wburningham This was a bug fix and is intended behaviour. The TASKFILE_DIR variable is supposed to hold the value of the path to the Taskfile in which the current task is stored.
If this is the intended behavior, I likely misunderstand what the real-world use of dir would be when including taskfiles.
If you extend the cmds section in your example to include an echo of $PWD, it becomes somewhat clearer what dir actually does in an includes. For example:
root | ROOT_DIR = '/home/pete/dev/github.com/go-task/task/tmp/1579'
root | TASKFILE_DIR = '/home/pete/dev/github.com/go-task/task/tmp/1579'
root | PWD = '/home/pete/dev/github.com/go-task/task'
sub with | ROOT_DIR = '/home/pete/dev/github.com/go-task/task/tmp/1579'
sub with | TASKFILE_DIR = '/home/pete/dev/github.com/go-task/task/tmp/1579/sub_with_dir'
sub with | PWD = '/home/pete/dev/github.com/go-task/task/tmp/1579/sub_with_dir'
sub without | ROOT_DIR = '/home/pete/dev/github.com/go-task/task/tmp/1579'
sub without | TASKFILE_DIR = '/home/pete/dev/github.com/go-task/task/tmp/1579/sub_without_dir'
sub without | PWD = '/home/pete/dev/github.com/go-task/task/tmp/1579'
You can see that the execution directory changes to ./sub_with_dir when the dir is included, but stays the same as the root Taskfile when omitted.
Task
v3.35.1
sets the directory of included taskfiles to the directory where the taskfile lives. In taskv3.34.1
the directory had to explicitly be set withdir
when including the taskfile.If this is the intended behavior, I likely misunderstand what the real-world use of
dir
would be when including taskfiles.A simple repro case:
The taskfiles in the
sub*
directories print the same variablesWith 3.34.1:
With 3.35.1:
Notice how the
TASKFILE_DIR
variable is different for the taskfile included fromsub_with_dir
and withdir
set.3.34.1
vs3.35.1
macOS 14.2
The text was updated successfully, but these errors were encountered: