-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
*: fix nakedret lint #16601
*: fix nakedret lint #16601
Conversation
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 @fuweid 👍🏻
Almost all the named return parameters are bad examples. The only exception is the one used in wal.go, it makes sense, because it makes the meaning of the returned value more clear. So suggest to convert all the named return parameter to naked return parameters except the wal.go. Reference: https://github.com/golang/go/wiki/CodeReviewComments#named-result-parameters |
@ahrtr sorry for the late reply. The nakedret is used to detect the named return lint issue. The code change is caused by nakedret. I think we can keep the named return var for Maybe we can improve the https://github.com/alexkohler/nakedret/blob/564f756361f1c6a648f759199ab7c03c59cae6dc/cmd/nakedret/main.go#L16 to config max function length which the nakedret tolerances. Or if it's not useful in etcd repo, we can consider to remove the lint. |
@@ -104,7 +104,7 @@ type tlsKeepaliveListener struct { | |||
func (l *tlsKeepaliveListener) Accept() (c net.Conn, err error) { |
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.
func (l *tlsKeepaliveListener) Accept() (c net.Conn, err error) { | |
func (l *tlsKeepaliveListener) Accept() (net.Conn, error) { |
To be clearer, the PR makes sense to me. I was requesting to make change something like #16601 (comment). The only exception is the named return parameter used in wal.go, it makes sense, so let's keep it as it's. |
Sorry for the confusion, I should be more clearer in the first place. |
Signed-off-by: Wei Fu <fuweid89@gmail.com>
30dd006
to
e72c2c4
Compare
@@ -245,7 +250,7 @@ func prepareData(cfg config.ServerConfig) (err error) { | |||
func createWALFileWithSnapshotRecord(cfg config.ServerConfig, snapshotTerm, snapshotIndex uint64) (err error) { |
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 err
is used in defer so keep it here.
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.
ack
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
thx @fuweid
Part of #15549
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.