diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-09-10 07:40:39 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-09-10 07:52:00 -0400 |
commit | 2c63b8439bbdc09203ea394ad2cf9352830861f0 (patch) | |
tree | 39b9d8d061bc248e4dbeb6445c2ad0c99b048ae1 /cmd | |
parent | 2d8417d86a7edf11bce5527f311bb951a651d40e (diff) | |
download | podman-2c63b8439bbdc09203ea394ad2cf9352830861f0.tar.gz podman-2c63b8439bbdc09203ea394ad2cf9352830861f0.tar.bz2 podman-2c63b8439bbdc09203ea394ad2cf9352830861f0.zip |
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>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/containers/cp.go | 12 | ||||
-rw-r--r-- | cmd/podman/containers/exec.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/kill.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/logs.go | 4 | ||||
-rw-r--r-- | cmd/podman/containers/pause.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/restart.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/rm.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/stop.go | 2 | ||||
-rw-r--r-- | cmd/podman/containers/unpause.go | 2 | ||||
-rw-r--r-- | cmd/podman/early_init_linux.go | 4 | ||||
-rw-r--r-- | cmd/podman/generate/systemd.go | 4 | ||||
-rw-r--r-- | cmd/podman/images/build.go | 6 | ||||
-rw-r--r-- | cmd/podman/images/list.go | 2 | ||||
-rw-r--r-- | cmd/podman/images/utils_linux.go | 2 | ||||
-rw-r--r-- | cmd/podman/machine/info.go | 2 | ||||
-rw-r--r-- | cmd/podman/pods/logs.go | 4 | ||||
-rw-r--r-- | cmd/podman/system/dial_stdio.go | 2 |
17 files changed, 28 insertions, 28 deletions
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go index c38cba66e..93477feb8 100644 --- a/cmd/podman/containers/cp.go +++ b/cmd/podman/containers/cp.go @@ -172,7 +172,7 @@ func copyContainerToContainer(sourceContainer string, sourcePath string, destCon return err } if err := copyFunc(); err != nil { - return fmt.Errorf("error copying from container: %w", err) + return fmt.Errorf("copying from container: %w", err) } return nil } @@ -192,7 +192,7 @@ func copyContainerToContainer(sourceContainer string, sourcePath string, destCon return err } if err := copyFunc(); err != nil { - return fmt.Errorf("error copying to container: %w", err) + return fmt.Errorf("copying to container: %w", err) } return nil } @@ -315,7 +315,7 @@ func copyFromContainer(container string, containerPath string, hostPath string) dir = filepath.Dir(dir) } if err := buildahCopiah.Put(dir, "", putOptions, reader); err != nil { - return fmt.Errorf("error copying to host: %w", err) + return fmt.Errorf("copying to host: %w", err) } return nil } @@ -327,7 +327,7 @@ func copyFromContainer(container string, containerPath string, hostPath string) return err } if err := copyFunc(); err != nil { - return fmt.Errorf("error copying from container: %w", err) + return fmt.Errorf("copying from container: %w", err) } return nil } @@ -424,7 +424,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er getOptions.Rename = map[string]string{filepath.Base(hostTarget): containerBaseName} } if err := buildahCopiah.Get("/", "", getOptions, []string{hostTarget}, writer); err != nil { - return fmt.Errorf("error copying from host: %w", err) + return fmt.Errorf("copying from host: %w", err) } return nil } @@ -441,7 +441,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er return err } if err := copyFunc(); err != nil { - return fmt.Errorf("error copying to container: %w", err) + return fmt.Errorf("copying to container: %w", err) } return nil } diff --git a/cmd/podman/containers/exec.go b/cmd/podman/containers/exec.go index 303795489..cbd090852 100644 --- a/cmd/podman/containers/exec.go +++ b/cmd/podman/containers/exec.go @@ -126,7 +126,7 @@ func exec(_ *cobra.Command, args []string) error { cliEnv, err := envLib.ParseSlice(envInput) if err != nil { - return fmt.Errorf("error parsing environment variables: %w", err) + return fmt.Errorf("parsing environment variables: %w", err) } execOpts.Envs = envLib.Join(execOpts.Envs, cliEnv) diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go index c08b3abb6..86a7e3ff2 100644 --- a/cmd/podman/containers/kill.go +++ b/cmd/podman/containers/kill.go @@ -98,7 +98,7 @@ func kill(_ *cobra.Command, args []string) error { for _, cidFile := range killCidFiles { content, err := ioutil.ReadFile(cidFile) if err != nil { - return fmt.Errorf("error reading CIDFile: %w", err) + return fmt.Errorf("reading CIDFile: %w", err) } id := strings.Split(string(content), "\n")[0] args = append(args, id) diff --git a/cmd/podman/containers/logs.go b/cmd/podman/containers/logs.go index 9a9749210..e285a24d8 100644 --- a/cmd/podman/containers/logs.go +++ b/cmd/podman/containers/logs.go @@ -126,7 +126,7 @@ func logs(_ *cobra.Command, args []string) error { // parse time, error out if something is wrong since, err := util.ParseInputTime(logsOptions.SinceRaw, true) if err != nil { - return fmt.Errorf("error parsing --since %q: %w", logsOptions.SinceRaw, err) + return fmt.Errorf("parsing --since %q: %w", logsOptions.SinceRaw, err) } logsOptions.Since = since } @@ -134,7 +134,7 @@ func logs(_ *cobra.Command, args []string) error { // parse time, error out if something is wrong until, err := util.ParseInputTime(logsOptions.UntilRaw, false) if err != nil { - return fmt.Errorf("error parsing --until %q: %w", logsOptions.UntilRaw, err) + return fmt.Errorf("parsing --until %q: %w", logsOptions.UntilRaw, err) } logsOptions.Until = until } diff --git a/cmd/podman/containers/pause.go b/cmd/podman/containers/pause.go index 38c4f45aa..591523cf9 100644 --- a/cmd/podman/containers/pause.go +++ b/cmd/podman/containers/pause.go @@ -94,7 +94,7 @@ func pause(cmd *cobra.Command, args []string) error { for _, cidFile := range pauseCidFiles { content, err := ioutil.ReadFile(cidFile) if err != nil { - return fmt.Errorf("error reading CIDFile: %w", err) + return fmt.Errorf("reading CIDFile: %w", err) } id := strings.Split(string(content), "\n")[0] args = append(args, id) diff --git a/cmd/podman/containers/restart.go b/cmd/podman/containers/restart.go index 4e0e96411..0cc7901f9 100644 --- a/cmd/podman/containers/restart.go +++ b/cmd/podman/containers/restart.go @@ -107,7 +107,7 @@ func restart(cmd *cobra.Command, args []string) error { for _, cidFile := range restartCidFiles { content, err := ioutil.ReadFile(cidFile) if err != nil { - return fmt.Errorf("error reading CIDFile: %w", err) + return fmt.Errorf("reading CIDFile: %w", err) } id := strings.Split(string(content), "\n")[0] args = append(args, id) diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go index 9c760e752..44d03e9de 100644 --- a/cmd/podman/containers/rm.go +++ b/cmd/podman/containers/rm.go @@ -110,7 +110,7 @@ func rm(cmd *cobra.Command, args []string) error { for _, cidFile := range rmCidFiles { content, err := ioutil.ReadFile(cidFile) if err != nil { - return fmt.Errorf("error reading CIDFile: %w", err) + return fmt.Errorf("reading CIDFile: %w", err) } id := strings.Split(string(content), "\n")[0] args = append(args, id) diff --git a/cmd/podman/containers/stop.go b/cmd/podman/containers/stop.go index 7e31aa7d5..412c513e1 100644 --- a/cmd/podman/containers/stop.go +++ b/cmd/podman/containers/stop.go @@ -107,7 +107,7 @@ func stop(cmd *cobra.Command, args []string) error { for _, cidFile := range stopCidFiles { content, err := ioutil.ReadFile(cidFile) if err != nil { - return fmt.Errorf("error reading CIDFile: %w", err) + return fmt.Errorf("reading CIDFile: %w", err) } id := strings.Split(string(content), "\n")[0] args = append(args, id) diff --git a/cmd/podman/containers/unpause.go b/cmd/podman/containers/unpause.go index 617c0e3a4..988964266 100644 --- a/cmd/podman/containers/unpause.go +++ b/cmd/podman/containers/unpause.go @@ -101,7 +101,7 @@ func unpause(cmd *cobra.Command, args []string) error { for _, cidFile := range unpauseCidFiles { content, err := ioutil.ReadFile(cidFile) if err != nil { - return fmt.Errorf("error reading CIDFile: %w", err) + return fmt.Errorf("reading CIDFile: %w", err) } id := strings.Split(string(content), "\n")[0] args = append(args, id) diff --git a/cmd/podman/early_init_linux.go b/cmd/podman/early_init_linux.go index e26c4264e..99046a02b 100644 --- a/cmd/podman/early_init_linux.go +++ b/cmd/podman/early_init_linux.go @@ -14,11 +14,11 @@ func setRLimits() error { rlimits.Max = define.RLimitDefaultValue if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { - return fmt.Errorf("error getting rlimits: %w", err) + return fmt.Errorf("getting rlimits: %w", err) } rlimits.Cur = rlimits.Max if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil { - return fmt.Errorf("error setting new rlimits: %w", err) + return fmt.Errorf("setting new rlimits: %w", err) } } return nil diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go index a7cdd9bfe..3473c9011 100644 --- a/cmd/podman/generate/systemd.go +++ b/cmd/podman/generate/systemd.go @@ -150,7 +150,7 @@ func systemd(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed(envFlagName) { cliEnv, err := envLib.ParseSlice(envInput) if err != nil { - return fmt.Errorf("error parsing environment variables: %w", err) + return fmt.Errorf("parsing environment variables: %w", err) } systemdOptions.AdditionalEnvVariables = envLib.Slice(cliEnv) } @@ -169,7 +169,7 @@ func systemd(cmd *cobra.Command, args []string) error { if files { cwd, err := os.Getwd() if err != nil { - return fmt.Errorf("error getting current working directory: %w", err) + return fmt.Errorf("getting current working directory: %w", err) } for name, content := range reports.Units { path := filepath.Join(cwd, fmt.Sprintf("%s.service", name)) diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index 837b233f4..2b24c1cff 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -222,7 +222,7 @@ func build(cmd *cobra.Command, args []string) error { // The context directory could be a URL. Try to handle that. tempDir, subDir, err := buildahDefine.TempDirForURL("", "buildah", args[0]) if err != nil { - return fmt.Errorf("error prepping temporary context directory: %w", err) + return fmt.Errorf("prepping temporary context directory: %w", err) } if tempDir != "" { // We had to download it to a temporary directory. @@ -237,7 +237,7 @@ func build(cmd *cobra.Command, args []string) error { // Nope, it was local. Use it as is. absDir, err := filepath.Abs(args[0]) if err != nil { - return fmt.Errorf("error determining path to directory %q: %w", args[0], err) + return fmt.Errorf("determining path to directory %q: %w", args[0], err) } contextDir = absDir } @@ -253,7 +253,7 @@ func build(cmd *cobra.Command, args []string) error { } absFile, err := filepath.Abs(containerFiles[i]) if err != nil { - return fmt.Errorf("error determining path to file %q: %w", containerFiles[i], err) + return fmt.Errorf("determining path to file %q: %w", containerFiles[i], err) } contextDir = filepath.Dir(absFile) containerFiles[i] = absFile diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go index 94d8412e5..1c464d91c 100644 --- a/cmd/podman/images/list.go +++ b/cmd/podman/images/list.go @@ -225,7 +225,7 @@ func sortImages(imageS []*entities.ImageSummary) ([]imageReporter, error) { h.ImageSummary = *e h.Repository, h.Tag, err = tokenRepoTag(tag) if err != nil { - return nil, fmt.Errorf("error parsing repository tag: %q: %w", tag, err) + return nil, fmt.Errorf("parsing repository tag: %q: %w", tag, err) } if h.Tag == "<none>" { untagged = append(untagged, h) diff --git a/cmd/podman/images/utils_linux.go b/cmd/podman/images/utils_linux.go index 5923716ec..935a45667 100644 --- a/cmd/podman/images/utils_linux.go +++ b/cmd/podman/images/utils_linux.go @@ -26,7 +26,7 @@ func setupPipe() (string, func() <-chan error, error) { if e := os.RemoveAll(pipeDir); e != nil { logrus.Errorf("Removing named pipe: %q", e) } - return "", nil, fmt.Errorf("error creating named pipe: %w", err) + return "", nil, fmt.Errorf("creating named pipe: %w", err) } go func() { fpipe, err := os.Open(pipePath) diff --git a/cmd/podman/machine/info.go b/cmd/podman/machine/info.go index 418060675..1151f9e86 100644 --- a/cmd/podman/machine/info.go +++ b/cmd/podman/machine/info.go @@ -57,7 +57,7 @@ func info(cmd *cobra.Command, args []string) error { info := entities.MachineInfo{} version, err := define.GetVersion() if err != nil { - return fmt.Errorf("error getting version info %w", err) + return fmt.Errorf("getting version info %w", err) } info.Version = version diff --git a/cmd/podman/pods/logs.go b/cmd/podman/pods/logs.go index 0102d4b71..7093a7fa8 100644 --- a/cmd/podman/pods/logs.go +++ b/cmd/podman/pods/logs.go @@ -101,7 +101,7 @@ func logs(_ *cobra.Command, args []string) error { // parse time, error out if something is wrong since, err := util.ParseInputTime(logsPodOptions.SinceRaw, true) if err != nil { - return fmt.Errorf("error parsing --since %q: %w", logsPodOptions.SinceRaw, err) + return fmt.Errorf("parsing --since %q: %w", logsPodOptions.SinceRaw, err) } logsPodOptions.Since = since } @@ -109,7 +109,7 @@ func logs(_ *cobra.Command, args []string) error { // parse time, error out if something is wrong until, err := util.ParseInputTime(logsPodOptions.UntilRaw, false) if err != nil { - return fmt.Errorf("error parsing --until %q: %w", logsPodOptions.UntilRaw, err) + return fmt.Errorf("parsing --until %q: %w", logsPodOptions.UntilRaw, err) } logsPodOptions.Until = until } diff --git a/cmd/podman/system/dial_stdio.go b/cmd/podman/system/dial_stdio.go index 42ce65746..db079856c 100644 --- a/cmd/podman/system/dial_stdio.go +++ b/cmd/podman/system/dial_stdio.go @@ -97,7 +97,7 @@ func copier(to halfWriteCloser, from halfReadCloser, debugDescription string) er } }() if _, err := io.Copy(to, from); err != nil { - return fmt.Errorf("error while Copy (%s): %w", debugDescription, err) + return fmt.Errorf("while Copy (%s): %w", debugDescription, err) } return nil } |