mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
use slices.concat
This commit is contained in:
@@ -2,6 +2,7 @@ package task
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"slices"
|
||||||
|
|
||||||
"github.com/go-task/task/v3/errors"
|
"github.com/go-task/task/v3/errors"
|
||||||
"github.com/go-task/task/v3/internal/env"
|
"github.com/go-task/task/v3/internal/env"
|
||||||
@@ -14,7 +15,7 @@ import (
|
|||||||
var ErrPreconditionFailed = errors.New("task: precondition not met")
|
var ErrPreconditionFailed = errors.New("task: precondition not met")
|
||||||
|
|
||||||
func (e *Executor) areTaskPreconditionsMet(ctx context.Context, t *ast.Task) (bool, error) {
|
func (e *Executor) areTaskPreconditionsMet(ctx context.Context, t *ast.Task) (bool, error) {
|
||||||
for _, p := range append(t.Preconditions, e.Taskfile.Preconditions.Preconditions...) {
|
for _, p := range slices.Concat(e.Taskfile.Preconditions.Preconditions, t.Preconditions) {
|
||||||
err := execext.RunCommand(ctx, &execext.RunCommandOptions{
|
err := execext.RunCommand(ctx, &execext.RunCommandOptions{
|
||||||
Command: p.Sh,
|
Command: p.Sh,
|
||||||
Dir: t.Dir,
|
Dir: t.Dir,
|
||||||
|
Reference in New Issue
Block a user