1
0
mirror of https://github.com/go-task/task.git synced 2025-01-12 04:34:11 +02:00

use status.Glob for watch globbing

This commit is contained in:
Landon Dyck 2021-05-08 15:02:08 -05:00
parent f8545d4c61
commit b825ad6a12
3 changed files with 5 additions and 5 deletions

View File

@ -53,7 +53,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
if len(c.Generates) > 0 {
// For each specified 'generates' field, check whether the files actually exist
for _, g := range c.Generates {
generates, err := glob(c.TaskDir, g)
generates, err := Glob(c.TaskDir, g)
if os.IsNotExist(err) {
return false, nil
}

View File

@ -13,7 +13,7 @@ import (
func globs(dir string, globs []string) ([]string, error) {
files := make([]string, 0)
for _, g := range globs {
f, err := glob(dir, g)
f, err := Glob(dir, g)
if err != nil {
continue
}
@ -23,7 +23,7 @@ func globs(dir string, globs []string) ([]string, error) {
return files, nil
}
func glob(dir string, g string) ([]string, error) {
func Glob(dir string, g string) ([]string, error) {
files := make([]string, 0)
if !filepath.IsAbs(g) {
g = filepath.Join(dir, g)

View File

@ -11,8 +11,8 @@ import (
"time"
"github.com/go-task/task/v3/internal/logger"
"github.com/go-task/task/v3/internal/status"
"github.com/go-task/task/v3/taskfile"
"github.com/mattn/go-zglob"
"github.com/radovskyb/watcher"
)
@ -128,7 +128,7 @@ func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...taskfile.Ca
}
for _, s := range task.Sources {
files, err := zglob.Glob(s)
files, err := status.Glob(task.Dir, s)
if err != nil {
return fmt.Errorf("task: %s: %w", s, err)
}