Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

lunny
Copy link
Member

@lunny lunny commented Aug 17, 2022

Fix #20709

@lunny lunny added type/miscellaneous backport/v1.17 skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Aug 17, 2022

select {
case <-c.ctx.Done():
return nil, c.ctx.Err()
return
Copy link
Member

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 returns?

@@ -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)
Copy link
Member

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

Suggested change
log.Error("CheckPath returns error: %v", err)
log.Error("CheckPath returns error: %w", err)
return err

or

Suggested change
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 {
Copy link
Member

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?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 18, 2022
@lunny lunny closed this Oct 23, 2022
@lunny lunny deleted the lunny/error_log branch October 23, 2022 04:30
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/miscellaneous
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CheckPath returns error: context canceled
3 participants