Removing unnecessary conditionals from block storage
diff --git a/openstack/blockstorage/v1/apiversions/results.go b/openstack/blockstorage/v1/apiversions/results.go
index c4ac157..ea2f7f5 100644
--- a/openstack/blockstorage/v1/apiversions/results.go
+++ b/openstack/blockstorage/v1/apiversions/results.go
@@ -37,11 +37,8 @@
}
err := mapstructure.Decode(page.(APIVersionPage).Body, &resp)
- if err != nil {
- return nil, err
- }
- return resp.Versions, nil
+ return resp.Versions, err
}
// GetResult represents the result of a get operation.
@@ -56,9 +53,6 @@
}
err := mapstructure.Decode(r.Resp, &resp)
- if err != nil {
- return nil, err
- }
- return resp.Version, nil
+ return resp.Version, err
}
diff --git a/openstack/blockstorage/v1/snapshots/results.go b/openstack/blockstorage/v1/snapshots/results.go
index 9509bca..d23090d 100644
--- a/openstack/blockstorage/v1/snapshots/results.go
+++ b/openstack/blockstorage/v1/snapshots/results.go
@@ -1,8 +1,6 @@
package snapshots
import (
- "fmt"
-
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
@@ -91,8 +89,6 @@
}
err := mapstructure.Decode(r.Resp, &res)
- if err != nil {
- return nil, fmt.Errorf("snapshots: Error decoding snapshots.commonResult: %v", err)
- }
- return res.Snapshot, nil
+
+ return res.Snapshot, err
}
diff --git a/openstack/blockstorage/v1/volumes/results.go b/openstack/blockstorage/v1/volumes/results.go
index 78c863f..78eb6c1 100644
--- a/openstack/blockstorage/v1/volumes/results.go
+++ b/openstack/blockstorage/v1/volumes/results.go
@@ -1,8 +1,6 @@
package volumes
import (
- "fmt"
-
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
@@ -80,8 +78,6 @@
}
err := mapstructure.Decode(r.Resp, &res)
- if err != nil {
- return nil, fmt.Errorf("volumes: Error decoding volumes.commonResult: %v", err)
- }
- return res.Volume, nil
+
+ return res.Volume, err
}
diff --git a/openstack/blockstorage/v1/volumetypes/results.go b/openstack/blockstorage/v1/volumetypes/results.go
index 8e5932a..77cc1f5 100644
--- a/openstack/blockstorage/v1/volumetypes/results.go
+++ b/openstack/blockstorage/v1/volumetypes/results.go
@@ -1,8 +1,6 @@
package volumetypes
import (
- "fmt"
-
"github.com/mitchellh/mapstructure"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
@@ -64,9 +62,6 @@
}
err := mapstructure.Decode(r.Resp, &res)
- if err != nil {
- return nil, fmt.Errorf("Error decoding Volume Type: %v", err)
- }
- return res.VolumeType, nil
+ return res.VolumeType, err
}