From b825ad6a12abf405bb1762a7c6b8fb2646033767 Mon Sep 17 00:00:00 2001 From: Landon Dyck Date: Sat, 8 May 2021 15:02:08 -0500 Subject: [PATCH] use status.Glob for watch globbing --- internal/status/checksum.go | 2 +- internal/status/glob.go | 4 ++-- watch.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/status/checksum.go b/internal/status/checksum.go index 16d730b9..2ab6a9ff 100644 --- a/internal/status/checksum.go +++ b/internal/status/checksum.go @@ -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 } diff --git a/internal/status/glob.go b/internal/status/glob.go index 65d20736..6ecaa749 100644 --- a/internal/status/glob.go +++ b/internal/status/glob.go @@ -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) diff --git a/watch.go b/watch.go index 15f56871..b5e443c8 100644 --- a/watch.go +++ b/watch.go @@ -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) }