diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go index b6dc05cb87..7db368a38f 100644 --- a/cmd/podman/volumes/prune.go +++ b/cmd/podman/volumes/prune.go @@ -64,9 +64,6 @@ func prune(cmd *cobra.Command, args []string) error { if !force { reader := bufio.NewReader(os.Stdin) fmt.Println("WARNING! This will remove all volumes not used by at least one container. The following volumes will be removed:") - if err != nil { - return err - } listOptions.Filter, err = parse.FilterArgumentsIntoFilters(filter) if err != nil { return err diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index 7b546d71a8..bc8ef31756 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -901,25 +901,19 @@ func (c *Container) resolveWorkDir() error { if !c.config.CreateWorkingDir { // No need to create it (e.g., `--workdir=/foo`), so let's make sure // the path exists on the container. - if err != nil { - if os.IsNotExist(err) { - // If resolved Workdir path gets marked as a valid symlink, - // return nil cause this is valid use-case. - if c.isWorkDirSymlink(resolvedWorkdir) { - return nil - } - return fmt.Errorf("workdir %q does not exist on container %s", workdir, c.ID()) + if errors.Is(err, os.ErrNotExist) { + // If resolved Workdir path gets marked as a valid symlink, + // return nil cause this is valid use-case. + if c.isWorkDirSymlink(resolvedWorkdir) { + return nil } - // This might be a serious error (e.g., permission), so - // we need to return the full error. - return fmt.Errorf("detecting workdir %q on container %s: %w", workdir, c.ID(), err) + return fmt.Errorf("workdir %q does not exist on container %s", workdir, c.ID()) } - return nil + // This might be a serious error (e.g., permission), so + // we need to return the full error. + return fmt.Errorf("detecting workdir %q on container %s: %w", workdir, c.ID(), err) } if err := os.MkdirAll(resolvedWorkdir, 0755); err != nil { - if os.IsExist(err) { - return nil - } return fmt.Errorf("creating container %s workdir: %w", c.ID(), err) } @@ -1192,7 +1186,7 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error { return fmt.Errorf("exporting root file-system diff for %q: %w", c.ID(), err) } - addToTarFiles, err := crutils.CRCreateRootFsDiffTar(&rootFsChanges, c.state.Mountpoint, c.bundlePath()) + addToTarFiles, err = crutils.CRCreateRootFsDiffTar(&rootFsChanges, c.state.Mountpoint, c.bundlePath()) if err != nil { return err } diff --git a/libpod/runtime_pod_common.go b/libpod/runtime_pod_common.go index 408ad4b105..0cdcf176d1 100644 --- a/libpod/runtime_pod_common.go +++ b/libpod/runtime_pod_common.go @@ -90,11 +90,7 @@ func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, option break } } - if addPodErr != nil { - return nil, fmt.Errorf("adding pod to state: %w", addPodErr) - } - - return pod, nil + return nil, fmt.Errorf("adding pod to state: %w", addPodErr) } // AddInfra adds the created infra container to the pod state diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 0f38f63c6d..4c58220878 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -785,7 +785,7 @@ func (ir *ImageEngine) Scp(ctx context.Context, src, dst string, opts entities.I if err != nil { return nil, err } - if (report.LoadReport == nil && err == nil) && (report.Source != nil && report.Dest != nil) { // we need to execute the transfer + if report.LoadReport == nil && (report.Source != nil && report.Dest != nil) { // we need to execute the transfer transferOpts := entities.ScpTransferOptions{} transferOpts.ParentFlags = report.ParentFlags _, err := Transfer(ctx, *report.Source, *report.Dest, transferOpts) diff --git a/pkg/machine/ocipull/source.go b/pkg/machine/ocipull/source.go index 2ce0e3956f..4267fe2a74 100644 --- a/pkg/machine/ocipull/source.go +++ b/pkg/machine/ocipull/source.go @@ -35,9 +35,6 @@ func GetLocalBlob(ctx context.Context, path string) (*types.BlobInfo, error) { return nil, err } blobs := img.LayerInfos() - if err != nil { - return nil, err - } if len(blobs) != 1 { return nil, errors.New("invalid disk image") }