rados: remove errcheck linter warnings

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson 2021-09-15 19:27:15 +02:00 committed by mergify[bot]
parent b7f01be284
commit 54fe45484a
4 changed files with 14 additions and 7 deletions

View File

@ -1175,7 +1175,9 @@ func (suite *RadosTestSuite) TestGetLastVersion() {
ioctx, err := suite.conn.OpenIOContext(suite.pool) ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err) require.NoError(suite.T(), err)
oid := suite.GenObjectName() oid := suite.GenObjectName()
defer suite.ioctx.Delete(oid) defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
v1, _ := ioctx.GetLastVersion() v1, _ := ioctx.GetLastVersion()
@ -1201,7 +1203,9 @@ func (suite *RadosTestSuite) TestGetLastVersion() {
ioctx, err := suite.conn.OpenIOContext(suite.pool) ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err) require.NoError(suite.T(), err)
oid := suite.GenObjectName() oid := suite.GenObjectName()
defer ioctx.Delete(oid) defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
v1, _ := ioctx.GetLastVersion() v1, _ := ioctx.GetLastVersion()
@ -1241,7 +1245,9 @@ func (suite *RadosTestSuite) TestGetLastVersion() {
vers := make([]uint64, 5) vers := make([]uint64, 5)
for i := 0; i < 5; i++ { for i := 0; i < 5; i++ {
oid := suite.GenObjectName() oid := suite.GenObjectName()
defer ioctx.Delete(oid) defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
err = ioctx.Write(oid, []byte(oid), 0) err = ioctx.Write(oid, []byte(oid), 0)
assert.NoError(t, err) assert.NoError(t, err)

View File

@ -30,7 +30,7 @@ func (suite *RadosTestSuite) TestReadOpAssertExists() {
// ensure a nil ioctx triggers a panic // ensure a nil ioctx triggers a panic
assert.Panics(suite.T(), func() { assert.Panics(suite.T(), func() {
op2.Operate(nil, "foo", OperationNoFlag) _ = op2.Operate(nil, "foo", OperationNoFlag)
}) })
} }

View File

@ -195,7 +195,6 @@ func (suite *RadosTestSuite) TestRollbackSnapshot() {
ioctx, err := suite.conn.OpenIOContext(suite.pool) ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err) require.NoError(suite.T(), err)
oid := suite.GenObjectName() oid := suite.GenObjectName()
defer suite.ioctx.Delete(oid)
err = ioctx.RollbackSnap(oid, "someName") err = ioctx.RollbackSnap(oid, "someName")
assert.Error(t, err) assert.Error(t, err)
@ -220,7 +219,9 @@ func (suite *RadosTestSuite) TestRollbackSnapshot() {
ioctx, err := suite.conn.OpenIOContext(suite.pool) ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err) require.NoError(suite.T(), err)
oid := suite.GenObjectName() oid := suite.GenObjectName()
defer suite.ioctx.Delete(oid) defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
bytesIn := []byte("Harry Potter") bytesIn := []byte("Harry Potter")
err = suite.ioctx.Write(oid, bytesIn, 0) err = suite.ioctx.Write(oid, bytesIn, 0)

View File

@ -31,7 +31,7 @@ func (suite *RadosTestSuite) TestWriteOpCreate() {
assert.Panics(suite.T(), func() { assert.Panics(suite.T(), func() {
op := CreateWriteOp() op := CreateWriteOp()
defer op.Release() defer op.Release()
op.Operate(nil, "foo", OperationNoFlag) _ = op.Operate(nil, "foo", OperationNoFlag)
}) })
} }