[kubeadm/app/]switch to github.com/pkg/errors

Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
This commit is contained in:
yuexiao-wang
2018-10-26 11:43:06 +08:00
parent 8616687c90
commit cc303c8774
83 changed files with 496 additions and 424 deletions

View File

@@ -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
}