These experimental packages are now available in the Go standard
library since Go 1.21:
1. golang.org/x/exp/slices -> slices [1]
2. golang.org/x/exp/maps -> maps [2]
[1]: https://go.dev/doc/go1.21#slices
[2]: https://go.dev/doc/go1.21#maps
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This change is generated by `go1.23rc2 fix ./...`.
Had to use go1.23rc2, since all released go versions have a bug
preventing it from working with `go 1.22.0` in go.mod (opened
https://github.com/golang/go/issues/68825,
https://github.com/golang/go/issues/68824 for awareness).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
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
[NO NEW TESTS NEEDED]
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
If errors for which os.IsExist() or os.IsNotExist() would have returned
true have been wrapped using fmt.Errorf()'s "%w" verb, os.IsExist() and
os.IsNotExist(), not having been retrofitted to use errors.Is(), will
return false.
Use errors.Is() to check if an error is an os.ErrExist or os.ErrNotExist
error instead of calling os.IsExist() or os.IsNotExist().
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Newer golangci-lint does not understand the nolint: directive
because it is followed by some comment.
To fix, add a comment before the (human) comment.
While at it, remove the space after // since comments targeted for
non-humans should not have space (this is currently not enforced by
golangci-lint).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Expand the list of OS/arch combinations we check when we're checking if
we can successfully be cross-compiled, and fix up a couple of places
that wouldn't pass otherwise.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When we go to unmount a tree of mounts, if one of the directories isn't
there, instead of returning an error as before, log a debug message and
keep going.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1996
Approved by: rhatdan
Make the chroot() call before applying a seccomp filter, which might not
allow us to do it. Add more debugging messages.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #979
Approved by: rhatdan
Factor out logic for unmounting our bind mounts, and make use of the
parent/child relationship between mountpoints to decide which order to
use, rather than sorting based on their mountpoint paths.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #800
Approved by: rhatdan
Break runSetupIntermediateMountNamespace() into its own package.
Move stringInSlice(), getHostIDs(), and getHostRootIDs() into the util
subdirectory and export them.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #796
Approved by: rhatdan