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

Feat/expose process info #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

halfcrazy
Copy link

No description provided.

Copy link
Owner

@cakturk cakturk left a comment

Choose a reason for hiding this comment

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

BTW, it would be better to introduce go module support in a separate commit.

pid int
name string
Pid int
Name string
}
Copy link
Owner

Choose a reason for hiding this comment

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

It makes sense, a few people already asked me to export these fields.

if err != nil {
return nil, err
}
binary.LittleEndian.PutUint32(ip[i:j], uint32(u))
Copy link
Owner

Choose a reason for hiding this comment

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

Good catch.

n, err := stat.Read(buf[:])
stat.Close()
if err != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

This is wrong. You don't need to check for nil there. os.Open always returns non-nil
value if it succeeded. Check the source code for os.Open.

@@ -253,8 +255,10 @@ func doNetstat(path string, fn AcceptFn) ([]SockTabEntry, error) {
if err != nil {
return nil, err
}
if f != nil {
defer f.Close()
}
Copy link
Owner

Choose a reason for hiding this comment

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

Here, again, the same situation as above. Nil-check is unnecessary here as the
os.Open already succeeded.

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.

2 participants