-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
server: fix unexported-return lint issue #19052
base: main
Are you sure you want to change the base?
Conversation
Hi @aladesawe. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi, @aladesawe. Thanks for your pull request 🙇.
Do you know how many issues there are in server? If there are not too many, it may be better to open a single pull request. We ideally want to keep the PR under 100 or 200 lines. Thanks, again. |
Hello @ivanvc sure thing, I'll pull more updates into this PR. There are about 10 more files with the error under the server module. |
/ok-to-test |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
... and 16 files with indirect coverage changes @@ Coverage Diff @@
## main #19052 +/- ##
==========================================
+ Coverage 68.85% 68.92% +0.06%
==========================================
Files 420 420
Lines 35716 35723 +7
==========================================
+ Hits 24593 24622 +29
+ Misses 9693 9681 -12
+ Partials 1430 1420 -10 Continue to review full report in Codecov by Sentry.
|
/test pull-etcd-govulncheck |
@aladesawe, I'm sorry it took me a while to respond to this pull request. I was out for the holidays and had a long backlog. A heads up that I raised this question in a similar pull request: #19105 (comment) Thanks for bearing with us :) |
No worries Ivan, understandable :). I see the comment, and will follow the conversation 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.
LGTM. Thanks, @aladesawe.
/retest |
@aladesawe, could you please squash your commits? |
66c71ea
to
e2a99cf
Compare
@@ -938,7 +938,7 @@ func (as *authStore) IsAuthEnabled() bool { | |||
} | |||
|
|||
// NewAuthStore creates a new AuthStore. | |||
func NewAuthStore(lg *zap.Logger, be AuthBackend, tp TokenProvider, bcryptCost int) *authStore { | |||
func NewAuthStore(lg *zap.Logger, be AuthBackend, tp TokenProvider, bcryptCost int) AuthStore { |
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.
Nice change!
@@ -33,7 +33,7 @@ type serverVersionAdapter struct { | |||
*EtcdServer | |||
} | |||
|
|||
func NewServerVersionAdapter(s *EtcdServer) *serverVersionAdapter { | |||
func NewServerVersionAdapter(s *EtcdServer) serverversion.Server { |
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.
Nice!
The changes, which use the existing interfaces, should can be merged right away. Could you raise a separate PR for that? All other changes, which introduce new interfaces, really need more careful review. Please raise a PR for each new interface. |
e2a99cf
to
da82a69
Compare
@ahrtr Moved all new interfaces to the own PRs |
/retest |
server/storage/schema/schema.go
Outdated
@@ -47,10 +48,7 @@ func localBinaryVersion() semver.Version { | |||
return semver.Version{Major: v.Major, Minor: v.Minor} | |||
} | |||
|
|||
type WALVersion interface { |
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.
@ahrtr see here. Version below is wal.Version. Please let me know what your concerns are
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.
OK, got it. thx for the clarification. Since the WALVersion
is only included in main
(release-3.5 doesn't have this interface), and we haven't release 3.6 yet. So it should be OK to rename it.
cc @serathius
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.
server/storage/schema/schema.go
Outdated
@@ -47,10 +48,7 @@ func localBinaryVersion() semver.Version { | |||
return semver.Version{Major: v.Major, Minor: v.Minor} | |||
} | |||
|
|||
type WALVersion interface { |
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.
OK, got it. thx for the clarification. Since the WALVersion
is only included in main
(release-3.5 doesn't have this interface), and we haven't release 3.6 yet. So it should be OK to rename it.
cc @serathius
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, aladesawe, ivanvc, mmorel-35 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 |
da82a69
to
977673a
Compare
c3e312c
to
87026bd
Compare
Asking for a review from @ahrtr again, as @aladesawe removed the change to |
asImpl, ok := as.(*authStore) | ||
require.Truef(t, ok, "addUserWithNoOption: needs an AuthStore implementation") |
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.
Can we add a validation in production code similar to below?
etcd/server/storage/schema/auth.go
Line 41 in 4abcda4
var _ auth.AuthBackend = (*authBackend)(nil) |
asImpl, ok := as.(*authStore) | |
require.Truef(t, ok, "addUserWithNoOption: needs an AuthStore implementation") |
sImpl, ok := s.(*watchableStore) | ||
require.Truef(t, ok, "TestWatchNoEventLossOnCompact: needs a WatchableKV implementation") |
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.
ditto
sImpl, ok := s.(*watchableStore) | |
require.Truef(t, ok, "TestWatchNoEventLossOnCompact: needs a WatchableKV implementation") |
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 already exists
var _ WatchableKV = (*watchableStore)(nil) |
Confirming if also suggesting to remove the assertions?
sImpl, ok := s.(*watchableStore) | ||
require.Truef(t, ok, "TestWatchBatchUnsynced: needs a WatchableKV implementation") |
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.
ditto
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.
Exists
var _ WatchableKV = (*watchableStore)(nil) |
@aladesawe, with breaking this pull request into multiple ones. I would suggest adding a ignore comment directive ( |
@ivanvc makes sense, that's good feedback. Do you anticipate we'll turn on the lint rule after this goes in, to target the server module specifically? Mind showing me how that'll be done? I had to go into the test script to localize server module while testing. I wasn't able to do include/exclude successfully via revive settings |
Signed-off-by: adeyemi <[email protected]>
87026bd
to
43c1b44
Compare
@aladesawe: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
PR to fix
unexported-return
lint issues under theserver
folder as mentioned in Issue 18370.This PR:
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.