-
-
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
Add golangci #6418
Add golangci #6418
Conversation
Looks like the new ci step works, now we just have to fix all the issues. |
Fixed most of the issues, however there are some issues where I don't really know what to do:
It looks like
I don't know how it is possible to let
I don't really think this is an issue... or is it?
If the errors are not checked, can the whole check be removed? Or how can we check for the error? |
# Conflicts: # models/repo_permission.go
@kolaente Is golangci support gitea? Since we will host gitea on gitea.com. If golangci don't support gitea, it will not work. |
@lunny It's just a binary file which runs locally and in drone. Since we run it on our own infrastructure, we're not tied to a particular platform. IIRC they offer tight ingration with github (things like having a bot which comments on the pr instead of just failing the pipeline) which we won't have. But I see no problem with it just failing the pipeline. |
Just merged with Gitea's master, it did containt a lot of new issues which had to be fixed... |
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.
That a lot of missed error checking and more could still be logged in goroutine or defer. This will really improve the codebase and review.
LGTM, I would suggest to disable most of the linter that still failed and manage to enable them one at a time in separates PRs. This will ease the process of review and limit the number of conflict appearing.
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.
Found one template file to be removed
@sapk I think we need to enable these now, I doubt there will be other prs soon otherwise... |
thanks @kolaente ! |
conflicted |
@lunny fixed. |
issue.LoadRepo() | ||
err := issue.LoadRepo() | ||
if err != nil { | ||
log.Error("LoadRepo: %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.
This function should return error as second return parameter I think.
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.
The problem is it is called in SendAsync
which just puts the mail in a queue to be sent. There's not much room for error handling there.
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.
Or we have to return nil here, otherwise it may panic when invoke issue.Repo.HTMLURL()
.
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.
The problem with this function is the error could never really be handled appropriatly. It would only be bubbled up to then be logged.
I would prefer to leave it as it is, to not having to deal with more complexty bubbling the error up would bring.
Signed-off-by: konrad <konrad@kola-entertainments.de>
This pr adds golangci to Gitea and replaces some linters (which golangci contains). This will (hopefully) enhance code quality.
Golangci lint calls a lot of golang lint tools directly, which make it a lot faster.