-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
make CheckPath logic clear #20823
make CheckPath logic clear #20823
Conversation
|
||
select { | ||
case <-c.ctx.Done(): | ||
return nil, c.ctx.Err() | ||
return |
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.
Didn't we disable these kind of return
s?
@@ -55,7 +58,9 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err | |||
|
|||
if checker != nil { | |||
attrs, err := checker.CheckPath(f.Name) | |||
if err == nil { | |||
if err != nil { | |||
log.Error("CheckPath returns error: %v", err) |
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.
Why not
return err
here?
So either
log.Error("CheckPath returns error: %v", err) | |
log.Error("CheckPath returns error: %w", err) | |
return err |
or
log.Error("CheckPath returns error: %v", err) | |
return err |
if err == nil { | ||
if err != nil { | ||
log.Error("CheckPath returns error: %v", err) | ||
} else { | ||
if vendored, has := attrs["linguist-vendored"]; has { |
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.
Wait, we have the same code in two different files?
Should we perhaps extract the common things into one method?
Fix #20709