mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-23 07:29:39 +00:00
[kubeadm/app/]switch to github.com/pkg/errors
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
This commit is contained in:
@@ -19,7 +19,7 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
@@ -30,11 +30,11 @@ import (
|
||||
// `rootfs`
|
||||
func Chroot(rootfs string) error {
|
||||
if err := syscall.Chroot(rootfs); err != nil {
|
||||
return fmt.Errorf("unable to chroot to %s: %v", rootfs, err)
|
||||
return errors.Wrapf(err, "unable to chroot to %s", rootfs)
|
||||
}
|
||||
root := filepath.FromSlash("/")
|
||||
if err := os.Chdir(root); err != nil {
|
||||
return fmt.Errorf("unable to chdir to %s: %v", root, err)
|
||||
return errors.Wrapf(err, "unable to chdir to %s", root)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user