From 973bffd0f6f85dae594d18f97189820fc3c88085 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 15 Mar 2021 13:55:52 +0100 Subject: [PATCH] fix error linting Signed-off-by: Sebastiaan van Stijn --- nat/nat.go | 6 +++--- nat/parse.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nat/nat.go b/nat/nat.go index 9b8aa874..684e4f34 100644 --- a/nat/nat.go +++ b/nat/nat.go @@ -192,7 +192,7 @@ func ParsePortSpec(rawPort string) ([]PortMapping, error) { ip = rawIP } if ip != "" && net.ParseIP(ip) == nil { - return nil, fmt.Errorf("invalid IP address: %s", ip) + return nil, errors.New("invalid IP address: " + ip) } if containerPort == "" { return nil, fmt.Errorf("no port specified: %s", rawPort) @@ -200,14 +200,14 @@ func ParsePortSpec(rawPort string) ([]PortMapping, error) { startPort, endPort, err := ParsePortRange(containerPort) if err != nil { - return nil, fmt.Errorf("invalid containerPort: %s", containerPort) + return nil, errors.New("invalid containerPort: " + containerPort) } var startHostPort, endHostPort uint64 = 0, 0 if len(hostPort) > 0 { startHostPort, endHostPort, err = ParsePortRange(hostPort) if err != nil { - return nil, fmt.Errorf("invalid hostPort: %s", hostPort) + return nil, errors.New("invalid hostPort: " + hostPort) } } diff --git a/nat/parse.go b/nat/parse.go index e4b53e8a..64affa2a 100644 --- a/nat/parse.go +++ b/nat/parse.go @@ -1,7 +1,7 @@ package nat import ( - "fmt" + "errors" "strconv" "strings" ) @@ -9,7 +9,7 @@ import ( // ParsePortRange parses and validates the specified string as a port-range (8000-9000) func ParsePortRange(ports string) (uint64, uint64, error) { if ports == "" { - return 0, 0, fmt.Errorf("empty string specified for ports") + return 0, 0, errors.New("empty string specified for ports") } if !strings.Contains(ports, "-") { start, err := strconv.ParseUint(ports, 10, 16) @@ -27,7 +27,7 @@ func ParsePortRange(ports string) (uint64, uint64, error) { return 0, 0, err } if end < start { - return 0, 0, fmt.Errorf("invalid range specified for port: %s", ports) + return 0, 0, errors.New("invalid range specified for port: " + ports) } return start, end, nil }