1
0
mirror of https://github.com/go-task/task.git synced 2025-11-27 22:38:20 +02:00

Issue #519: Allow includes to be optional

This commit is contained in:
Sally Young
2021-08-11 17:28:44 +01:00
parent 50e5813222
commit 8f80fc4e2c
8 changed files with 93 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
includedTask = taskfile.IncludedTaskfile{
Taskfile: tr.Replace(includedTask.Taskfile),
Dir: tr.Replace(includedTask.Dir),
Optional: includedTask.Optional,
AdvancedImport: includedTask.AdvancedImport,
}
if err := tr.Err(); err != nil {
@@ -56,6 +57,9 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
}
info, err := os.Stat(path)
if err != nil && includedTask.Optional {
return nil
}
if err != nil {
return err
}