mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
cleanup: use standard Golang errors package
"github.com/pkg/errors" does not offer more functionlity than that we need from the standard "errors" package. With Golang v1.13 errors can be wrapped with `fmt.Errorf("... %w", err)`. `errors.Is()` and `errors.As()` are available as well. See-also: https://tip.golang.org/doc/go1.13#error_wrapping Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
8effa0cd3e
commit
92aae4834e
@ -17,10 +17,11 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ceph/go-ceph/rados"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type ClusterConnection struct {
|
||||
@ -46,7 +47,7 @@ func (cc *ClusterConnection) Connect(monitors string, cr *Credentials) error {
|
||||
if cc.conn == nil {
|
||||
conn, err := connPool.Get(monitors, cr.ID, cr.KeyFile)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to get connection")
|
||||
return fmt.Errorf("failed to get connection: %w", err)
|
||||
}
|
||||
|
||||
cc.conn = conn
|
||||
@ -75,7 +76,7 @@ func (cc *ClusterConnection) GetIoctx(pool string) (*rados.IOContext, error) {
|
||||
if err == rados.ErrNotFound {
|
||||
err = ErrPoolNotFound{pool, err}
|
||||
} else {
|
||||
err = errors.Wrapf(err, "failed to open IOContext for pool %s", pool)
|
||||
err = fmt.Errorf("failed to open IOContext for pool %s: %w", pool, err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user