Two small improvements to code quality#2560
Merged
rawtaz merged 3 commits intorestic:masterfrom Feb 12, 2020
brualan:master
Merged
Two small improvements to code quality#2560rawtaz merged 3 commits intorestic:masterfrom brualan:master
rawtaz merged 3 commits intorestic:masterfrom
brualan:master
Conversation
I was running "golangci-lint" and found this two warnings
internal/checker/checker.go:135:18: (*Checker).LoadIndex$3 - result 0 (error) is always nil (unparam)
final := func() error {
^
internal/repository/repository.go:457:18: (*Repository).LoadIndex$3 - result 0 (error) is always nil (unparam)
final := func() error {
^
It turns out that these functions are used only in "RunWorkers(...)",
which is used only two times in whole project right after this "final"
functions.
And because these "final" functions always return "nil", I've
descided, that it would be better to remove requriments for "final" func
to return error to avoid magick "return nil" at their end.
in case of len(format) == 0, we will get an "index out of range" error Usage of strings.HasSuffix is allowing to avoid that
fd0
approved these changes
Feb 12, 2020
Member
fd0
left a comment
There was a problem hiding this comment.
LGTM, thanks for taking the time!
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of this change? What does it change?
It's two small improvements to code quality. Details can be found in commit messages
Was the change discussed in an issue or in the forum before?
No, I made changes on my own initiative
Checklist
changelog/unreleased/that describes the changes for our users (template here)gofmton the code in all commits