WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 1fc061c

Browse files
authored
Merge pull request #124 from thaJeztah/fix_error_linting
fix error linting
2 parents 1401877 + 973bffd commit 1fc061c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

nat/nat.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,22 @@ func ParsePortSpec(rawPort string) ([]PortMapping, error) {
192192
ip = rawIP
193193
}
194194
if ip != "" && net.ParseIP(ip) == nil {
195-
return nil, fmt.Errorf("invalid IP address: %s", ip)
195+
return nil, errors.New("invalid IP address: " + ip)
196196
}
197197
if containerPort == "" {
198198
return nil, fmt.Errorf("no port specified: %s<empty>", rawPort)
199199
}
200200

201201
startPort, endPort, err := ParsePortRange(containerPort)
202202
if err != nil {
203-
return nil, fmt.Errorf("invalid containerPort: %s", containerPort)
203+
return nil, errors.New("invalid containerPort: " + containerPort)
204204
}
205205

206206
var startHostPort, endHostPort uint64 = 0, 0
207207
if len(hostPort) > 0 {
208208
startHostPort, endHostPort, err = ParsePortRange(hostPort)
209209
if err != nil {
210-
return nil, fmt.Errorf("invalid hostPort: %s", hostPort)
210+
return nil, errors.New("invalid hostPort: " + hostPort)
211211
}
212212
}
213213

nat/parse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package nat
22

33
import (
4-
"fmt"
4+
"errors"
55
"strconv"
66
"strings"
77
)
88

99
// ParsePortRange parses and validates the specified string as a port-range (8000-9000)
1010
func ParsePortRange(ports string) (uint64, uint64, error) {
1111
if ports == "" {
12-
return 0, 0, fmt.Errorf("empty string specified for ports")
12+
return 0, 0, errors.New("empty string specified for ports")
1313
}
1414
if !strings.Contains(ports, "-") {
1515
start, err := strconv.ParseUint(ports, 10, 16)
@@ -27,7 +27,7 @@ func ParsePortRange(ports string) (uint64, uint64, error) {
2727
return 0, 0, err
2828
}
2929
if end < start {
30-
return 0, 0, fmt.Errorf("invalid range specified for port: %s", ports)
30+
return 0, 0, errors.New("invalid range specified for port: " + ports)
3131
}
3232
return start, end, nil
3333
}

0 commit comments

Comments
 (0)