cleanup: address err113 warnings about direct error comparisons

Several places in the code compared errors directly with the go-ceph
sentinel errors.  This change uses the errors.Is() function of go
1.13 instead.  The err113 linter reported this issue as:

err113: do not compare errors directly, use errors.Is() instead

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson
2020-07-02 23:43:40 +02:00
committed by mergify[bot]
parent 7affb9289d
commit de74c36d8c
4 changed files with 29 additions and 29 deletions

View File

@ -73,7 +73,7 @@ func (cc *ClusterConnection) GetIoctx(pool string) (*rados.IOContext, error) {
ioctx, err := cc.conn.OpenIOContext(pool)
if err != nil {
// ErrNotFound indicates the Pool was not found
if err == rados.ErrNotFound {
if errors.Is(err, rados.ErrNotFound) {
err = ErrPoolNotFound{pool, err}
} else {
err = fmt.Errorf("failed to open IOContext for pool %s: %w", pool, err)