Fix stutters

Podman adds an Error: to every error message.  So starting an error
message with "error" ends up being reported to the user as

Error: error ...

This patch removes the stutter.

Also ioutil.ReadFile errors report the Path, so wrapping the err message
with the path causes a stutter.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2022-09-10 07:40:39 -04:00
parent 2d8417d86a
commit 2c63b8439b
116 changed files with 580 additions and 579 deletions

View File

@ -20,7 +20,7 @@ import (
func ReadPodIDFile(path string) (string, error) {
content, err := ioutil.ReadFile(path)
if err != nil {
return "", fmt.Errorf("error reading pod ID file: %w", err)
return "", fmt.Errorf("reading pod ID file: %w", err)
}
return strings.Split(string(content), "\n")[0], nil
}
@ -165,7 +165,7 @@ func parseSplitPort(hostIP, hostPort *string, ctrPort string, protocol *string)
}
ctrStart, ctrLen, err := parseAndValidateRange(ctrPort)
if err != nil {
return newPort, fmt.Errorf("error parsing container port: %w", err)
return newPort, fmt.Errorf("parsing container port: %w", err)
}
newPort.ContainerPort = ctrStart
newPort.Range = ctrLen
@ -197,7 +197,7 @@ func parseSplitPort(hostIP, hostPort *string, ctrPort string, protocol *string)
} else {
hostStart, hostLen, err := parseAndValidateRange(*hostPort)
if err != nil {
return newPort, fmt.Errorf("error parsing host port: %w", err)
return newPort, fmt.Errorf("parsing host port: %w", err)
}
if hostLen != ctrLen {
return newPort, fmt.Errorf("host and container port ranges have different lengths: %d vs %d", hostLen, ctrLen)