Skip to content

Conversation

@rbtr
Copy link
Collaborator

@rbtr rbtr commented Jul 7, 2021

Reason for Change:

A batch of cosmetic/non-functional changes to fix existing syntactic/style issues discovered by the linter.

Issue Fixed:

Requirements:

Notes:

nm = nil
}

log.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont we have to defer log.close() this ?

Copy link
Collaborator Author

@rbtr rbtr Jul 7, 2021

Choose a reason for hiding this comment

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

since the above for loop has no break this is unreachable code and we don't currently ever call Close().
so i don't know if we need to, but if it hasn't been a problem i would guess no.

Copy link
Member

Choose a reason for hiding this comment

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

its good practice to have defer log.Close()..if someone changes this behaviour tomorrow, then they may fail to add log.close()

Copy link
Collaborator Author

@rbtr rbtr Jul 8, 2021

Choose a reason for hiding this comment

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

@tamilmani1989 I read through the log package and I don't think it's safe to call log.Close() (even deferred) the way that it's written right now. We could accidentally close stdout or stderr and prevent the go runtime from writing the crash logs during a panic. That needs some work and is out of scope for this linting fix imo.

nm = nil
}

log.Close()
Copy link
Member

Choose a reason for hiding this comment

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

its good practice to have defer log.Close()..if someone changes this behaviour tomorrow, then they may fail to add log.close()

// Relay these incoming signals to OS signal channel.
osSignalChannel := make(chan os.Signal, 1)
signal.Notify(osSignalChannel, os.Interrupt, os.Kill, syscall.SIGTERM)
signal.Notify(osSignalChannel, os.Interrupt, syscall.SIGTERM)
Copy link
Member

Choose a reason for hiding this comment

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

did we test this change?

Copy link
Collaborator Author

@rbtr rbtr Jul 7, 2021

Choose a reason for hiding this comment

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

os.Kill cannot be trapped, so including it in the Notify list is ineffective.

// Enable ip forwading on linux vm.
// sysctl -w net.ipv4.ip_forward=1
cmd := fmt.Sprintf(enableIPForwardCmd)
cmd := fmt.Sprint(enableIPForwardCmd)
Copy link
Member

Choose a reason for hiding this comment

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

why do we change this? what's the use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we are not doing a string interpolation so it's unnecessary to call Sprintf, and using the minimal Sprint is more correct

Copy link
Member

@tamilmani1989 tamilmani1989 left a comment

Choose a reason for hiding this comment

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

cni changes lgtm... leaving to vamsi/mat to sign off npm changes

Copy link
Contributor

@vakalapa vakalapa left a comment

Choose a reason for hiding this comment

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

lgtm, please wait for all the tests to complete and then you can merge.

@rbtr rbtr merged commit 45f3668 into master Jul 8, 2021
@rbtr rbtr deleted the rbtr/lint branch July 8, 2021 18:32
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.

4 participants