Skip to content

Commit

Permalink
cmd: Check error returned by GetPort (#83)
Browse files Browse the repository at this point in the history
Before this change, error returned by internal.GetPort was
assigned to err variable, but this assignment was ineffectual
and error was ignored.
  • Loading branch information
vadorovsky authored and rakyll committed Jul 11, 2018
1 parent e4108e7 commit 60aa68d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ func targetToAddr(target string) (*net.TCPAddr, error) {
return nil, fmt.Errorf("couldn't parse PID: %v", err)
}
port, err := internal.GetPort(pid)
if err != nil {
return nil, fmt.Errorf("couldn't get port for PID %s: %v", pid, err)
}
addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:"+port)
return addr, nil
}
Expand Down
Binary file added gops
Binary file not shown.

0 comments on commit 60aa68d

Please sign in to comment.