-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maybe should check the result of filepath.Glob() and return an error #265
Conversation
I've seen the refactor pr, maybe I should close mine? |
pkg/config/config.go
Outdated
if len(fileNames) == 0 && err == nil { | ||
err = fmt.Errorf("file: %s doesn't exist", *f.Path) | ||
} | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about?
if err != nil {
return err
}
if len(fileNames) == 0 {
return &os.PathError{Op: "open", Path: *f.Path, Err: fs.ErrNotExist}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be much better, I will resolve it promptly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@veezhang I have improved it, please check it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LooJee Good job!
Sorry, I find the ci is use go1.13, so maybe you should use os.ErrNotExist
instead of fs.ErrNotExist
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
filepath.Glob() won't return an error while files don't exist, maybe here should have an error. Because the expandFiles() will return an empty []*File, and the error is nil. Then the yaml.Files at cmd/runner.go/Run() will be an empty slice, then the statsMgr never receive a done signal.
How do you solve it?
Special notes for your reviewer, ex. impact of this fix, design document, etc: