Skip to content
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 golangci-lint issues and delete unused code. #1924

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kislaykishore
Copy link
Collaborator

Description

Link to the issue in case of a bug fix.

NA

Testing details

  1. Manual - NA
  2. Unit tests - NA
  3. Integration tests - NA

@kislaykishore kislaykishore marked this pull request as ready for review May 15, 2024 07:21
@kislaykishore kislaykishore requested review from ashmeenkaur and a team as code owners May 15, 2024 07:21
@sethiay sethiay requested a review from Tulsishah May 15, 2024 07:29
Copy link
Collaborator

@Tulsishah Tulsishah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we capture err and handle it accordingly wherever we ignore it through _ ?

@@ -602,7 +601,7 @@ func (t *ForeignModsTest) ReadBeyondEndOfFile() {
AssertEq(contents[contentLen-1], buf[0])

if err == nil {
n, err = f.Read(buf)
n, _ = f.Read(buf)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this should we put Assert(nil, err) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried doing that. Seems like these errors have been deliberately ignored. Adding such asserts causes the tests to fail.

@@ -240,7 +240,7 @@ func (t *AppendObjectCreatorTest) CallsComposeObjectsWithObjectProperties() {
WillOnce(Return(nil))

// Call
t.call()
_, _ = t.call()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we capture err and assert?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asserting for error not being nil causes tests to fail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is err not nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it isn't

@@ -332,15 +332,15 @@ const (
func (tf *tempFile) ensure(limit int64) error {
switch tf.state {
case fileIncomplete:
size, err := tf.f.Seek(0, 2)
size, _ := tf.f.Seek(0, 2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return err instead of ignoring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In certain io methods, an EOF is returned as error. So, an error might not always imply a problem. Therefore I'm a bit scared changing this logic as it might lead to behavior changes. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants