Skip to content

Commit

Permalink
- Some final fixes based on thockins comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
vegemitecheesetoast committed Aug 31, 2019
1 parent d5948ec commit 9ac6bf0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions net/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ func ParsePort(port string, allowZero bool) (int, error) {
if err != nil {
return 0, err
}
if int(portInt) == 0 && !allowZero {
errors.New("Port 0 is not allowed, provide non 0 port or make allowZero true")
if portInt == 0 && !allowZero {
errors.New("0 is not a valid port number")
}
return int(portInt), nil
}
3 changes: 1 addition & 2 deletions net/net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ func TestParsePort(t *testing.T) {
name: "zero port: allowed",
port: "0",
allowZero: true,
expectedError: false,
},
{
name: "zero port: not allowed",
Expand All @@ -507,7 +506,7 @@ func TestParsePort(t *testing.T) {

for _, rt := range tests {
t.Run(rt.name, func(t *testing.T) {
actualPort, actualError := ParsePort(rt.port, allowZero)
actualPort, actualError := ParsePort(rt.port, rt.allowZero)

if actualError != nil && !rt.expectedError {
t.Errorf("%s unexpected failure: %v", rt.name, actualError)
Expand Down

0 comments on commit 9ac6bf0

Please sign in to comment.