-
Notifications
You must be signed in to change notification settings - Fork 246
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
Enable revive linter #3241
Enable revive linter #3241
Conversation
Skipping CI for Draft Pull Request. |
/test all |
09e53f0
to
4cc50ea
Compare
4cc50ea
to
a5c62b6
Compare
d7fc229
to
5f6fdd2
Compare
/test all |
fb8d127
to
89eb44f
Compare
/test all |
Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
This function had quite a bit of redundant code (caught by the linter). The workgroup was never Done because all exit paths went through a log.Fatal. Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
The formatted code has nothing to do with this PR but we may as well include it. Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
89eb44f
to
ed4937b
Compare
pkg/importer/vddk-datasource_test.go
Outdated
@@ -666,14 +666,14 @@ var _ = Describe("VDDK get block status", func() { | |||
flagSetting := true | |||
currentMockNbdFunctions.BlockStatus = func(length uint64, offset uint64, callback libnbd.ExtentCallback, optargs *libnbd.BlockStatusOptargs) error { | |||
err := 0 | |||
len := uint32(MaxBlockStatusLength) | |||
L := uint32(MaxBlockStatusLength) |
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 use an upper case L instead of a lower case one?
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 linter dislikes shadowing built-in variables and functions such as len
, max
, etc.
The uppercase L is just my lack of originality
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.
Right it is just that normally upper cass variables indicate 'public' type variables. Which of course is not a thing inside a function, it is just confusing. I would just use lower case l and we can call it a day.
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.
Sounds good.
tools/cdi-func-test-proxy/main.go
Outdated
startServer(httpsPortWithAuth, withBasicAuth, true, wg) | ||
|
||
wg.Wait() | ||
select {} |
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 doesn't feel semantically the same as the wait groups. Am I missing something? Also I think the log.Fatal in startServer is probably a mistake on my part.
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.
Both things block forever until one of the startServer
exits the process with log.Fatal
. The calls to wg.Done()
are unreachable, so this wg was overkill.
I can rework this to not use log.Fatal and go back to workgroups if you prefer. In that case they wouldn't be overkill.
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.
IMO it should not exit until all the threads have finished and released their resources. So the original code is faulty as well. I would remove the log.Fatal. Not sure why I did that in the first place.
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 makes sense, yeah. Using some context cancellation that is easy to achieve.
…urce Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
This added quite a bit of boilerplate per call, so I put everything in a loop. Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
/test pull-containerized-data-importer-e2e-istio |
/test pull-containerized-data-importer-fossa |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awels The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Enables the revive linter:
Golint itself has been deprecated for 3 years.
Special notes for your reviewer:
PR #3193 removes golint from the
make lint-metrics
target.Release note: