mirror of
https://github.com/go-task/task.git
synced 2025-01-24 05:17:21 +02:00
Small improvements to #228
This commit is contained in:
parent
f5cd3eab9e
commit
0d9fdbaac1
@ -45,13 +45,16 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.Generates) != 0 {
|
if len(c.Generates) > 0 {
|
||||||
// For each specified 'generates' field, check whether the files actually exist.
|
// For each specified 'generates' field, check whether the files actually exist
|
||||||
for _, g := range c.Generates {
|
for _, g := range c.Generates {
|
||||||
generates, err := glob(c.Dir, g)
|
generates, err := glob(c.Dir, g)
|
||||||
if err != nil {
|
if os.IsNotExist(err) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
if len(generates) == 0 {
|
if len(generates) == 0 {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/mattn/go-zglob"
|
"github.com/mattn/go-zglob"
|
||||||
)
|
)
|
||||||
|
|
||||||
func globs(dir string, globs []string) ([]string, error){
|
func globs(dir string, globs []string) ([]string, error) {
|
||||||
files := make([]string, 0)
|
files := make([]string, 0)
|
||||||
for _, g := range globs {
|
for _, g := range globs {
|
||||||
f, err := glob(dir, g)
|
f, err := glob(dir, g)
|
||||||
@ -39,13 +39,12 @@ func glob(dir string, g string) ([]string, error) {
|
|||||||
for _, f := range fs {
|
for _, f := range fs {
|
||||||
info, err := os.Stat(f)
|
info, err := os.Stat(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
return nil, err
|
||||||
}
|
}
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
files = append(files, f)
|
files = append(files, f)
|
||||||
}
|
}
|
||||||
sort.Strings(files)
|
|
||||||
return files, nil
|
return files, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user