mirror of
https://github.com/go-task/task.git
synced 2025-01-08 04:04:08 +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 {
|
||||
// For each specified 'generates' field, check whether the files actually exist.
|
||||
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.Dir, g)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if len(generates) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
@ -39,13 +39,12 @@ func glob(dir string, g string) ([]string, error) {
|
||||
for _, f := range fs {
|
||||
info, err := os.Stat(f)
|
||||
if err != nil {
|
||||
continue
|
||||
return nil, err
|
||||
}
|
||||
if info.IsDir() {
|
||||
continue
|
||||
}
|
||||
files = append(files, f)
|
||||
}
|
||||
sort.Strings(files)
|
||||
return files, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user