mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
chore: run modernize
This commit is contained in:
2
task.go
2
task.go
@@ -80,7 +80,6 @@ func (e *Executor) Run(ctx context.Context, calls ...*Call) error {
|
|||||||
|
|
||||||
g, ctx := errgroup.WithContext(ctx)
|
g, ctx := errgroup.WithContext(ctx)
|
||||||
for _, c := range regularCalls {
|
for _, c := range regularCalls {
|
||||||
c := c
|
|
||||||
if e.Parallel {
|
if e.Parallel {
|
||||||
g.Go(func() error { return e.RunTask(ctx, c) })
|
g.Go(func() error { return e.RunTask(ctx, c) })
|
||||||
} else {
|
} else {
|
||||||
@@ -264,7 +263,6 @@ func (e *Executor) runDeps(ctx context.Context, t *ast.Task) error {
|
|||||||
defer reacquire()
|
defer reacquire()
|
||||||
|
|
||||||
for _, d := range t.Deps {
|
for _, d := range t.Deps {
|
||||||
d := d
|
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
err := e.RunTask(ctx, &Call{Task: d.Task, Vars: d.Vars, Silent: d.Silent, Indirect: true})
|
err := e.RunTask(ctx, &Call{Task: d.Task, Vars: d.Vars, Silent: d.Silent, Indirect: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -244,8 +244,8 @@ func (t *Tasks) UnmarshalYAML(node *yaml.Node) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func taskNameWithNamespace(taskName string, namespace string) string {
|
func taskNameWithNamespace(taskName string, namespace string) string {
|
||||||
if strings.HasPrefix(taskName, NamespaceSeparator) {
|
if after, ok := strings.CutPrefix(taskName, NamespaceSeparator); ok {
|
||||||
return strings.TrimPrefix(taskName, NamespaceSeparator)
|
return after
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s%s%s", namespace, NamespaceSeparator, taskName)
|
return fmt.Sprintf("%s%s%s", namespace, NamespaceSeparator, taskName)
|
||||||
}
|
}
|
||||||
|
|||||||
2
watch.go
2
watch.go
@@ -36,7 +36,6 @@ func (e *Executor) watchTasks(calls ...*Call) error {
|
|||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
for _, c := range calls {
|
for _, c := range calls {
|
||||||
c := c
|
|
||||||
go func() {
|
go func() {
|
||||||
err := e.RunTask(ctx, c)
|
err := e.RunTask(ctx, c)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -85,7 +84,6 @@ func (e *Executor) watchTasks(calls ...*Call) error {
|
|||||||
e.Compiler.ResetCache()
|
e.Compiler.ResetCache()
|
||||||
|
|
||||||
for _, c := range calls {
|
for _, c := range calls {
|
||||||
c := c
|
|
||||||
go func() {
|
go func() {
|
||||||
if ShouldIgnore(event.Name) {
|
if ShouldIgnore(event.Name) {
|
||||||
e.Logger.VerboseErrf(logger.Magenta, "task: event skipped for being an ignored dir: %s\n", event.Name)
|
e.Logger.VerboseErrf(logger.Magenta, "task: event skipped for being an ignored dir: %s\n", event.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user