named return vars
diff --git a/openstack/objectstorage/v1/accounts/requests.go b/openstack/objectstorage/v1/accounts/requests.go
index 41479a2..57616c0 100644
--- a/openstack/objectstorage/v1/accounts/requests.go
+++ b/openstack/objectstorage/v1/accounts/requests.go
@@ -23,14 +23,13 @@
// custom metadata, call the ExtractMetadata method on the GetResult. To extract
// all the headers that are returned (including the metadata), call the
// ExtractHeader method on the GetResult.
-func Get(c *gophercloud.ServiceClient, opts GetOptsBuilder) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, opts GetOptsBuilder) (r GetResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToAccountGetMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -44,7 +43,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// UpdateOptsBuilder allows extensions to add additional headers to the Update
@@ -77,14 +75,13 @@
// Update is a function that creates, updates, or deletes an account's metadata.
// To extract the headers returned, call the Extract method on the UpdateResult.
-func Update(c *gophercloud.ServiceClient, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, opts UpdateOptsBuilder) (r UpdateResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToAccountUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -98,5 +95,4 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
diff --git a/openstack/objectstorage/v1/containers/requests.go b/openstack/objectstorage/v1/containers/requests.go
index f575ea7..ba11916 100644
--- a/openstack/objectstorage/v1/containers/requests.go
+++ b/openstack/objectstorage/v1/containers/requests.go
@@ -89,14 +89,13 @@
}
// Create is a function that creates a new container.
-func Create(c *gophercloud.ServiceClient, containerName string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, containerName string, opts CreateOptsBuilder) (r CreateResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToContainerCreateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -110,14 +109,11 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// Delete is a function that deletes a container.
-func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, containerName string) (r DeleteResult) {
_, r.Err = c.Delete(deleteURL(c, containerName), nil)
- return r
}
// UpdateOptsBuilder allows extensions to add additional parameters to the
@@ -154,14 +150,13 @@
// Update is a function that creates, updates, or deletes a container's
// metadata.
-func Update(c *gophercloud.ServiceClient, containerName string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, containerName string, opts UpdateOptsBuilder) (r UpdateResult) {
h := make(map[string]string)
if opts != nil {
headers, err := opts.ToContainerUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
@@ -176,14 +171,12 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// Get is a function that retrieves the metadata of a container. To extract just
// the custom metadata, pass the GetResult response to the ExtractMetadata
// function.
-func Get(c *gophercloud.ServiceClient, containerName string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, containerName string) (r GetResult) {
resp, err := c.Request("HEAD", getURL(c, containerName), &gophercloud.RequestOpts{
OkCodes: []int{200, 204},
})
@@ -191,5 +184,4 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 2505bdb..5f8e7c1 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -107,15 +107,14 @@
// Download is a function that retrieves the content and metadata for an object.
// To extract just the content, pass the DownloadResult response to the
// ExtractContent function.
-func Download(c *gophercloud.ServiceClient, containerName, objectName string, opts DownloadOptsBuilder) DownloadResult {
- var r DownloadResult
+func Download(c *gophercloud.ServiceClient, containerName, objectName string, opts DownloadOptsBuilder) (r DownloadResult) {
url := downloadURL(c, containerName, objectName)
h := make(map[string]string)
if opts != nil {
headers, query, err := opts.ToObjectDownloadParams()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -132,7 +131,6 @@
r.Body = resp.Body
}
r.Err = err
- return r
}
// CreateOptsBuilder allows extensions to add additional parameters to the
@@ -192,8 +190,7 @@
// Create is a function that creates a new object or replaces an existing object. If the returned response's ETag
// header fails to match the local checksum, the failed request will automatically be retried up to a maximum of 3 times.
-func Create(c *gophercloud.ServiceClient, containerName, objectName string, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, containerName, objectName string, opts CreateOptsBuilder) (r CreateResult) {
url := createURL(c, containerName, objectName)
h := make(map[string]string)
var b io.Reader
@@ -201,7 +198,7 @@
tmpB, headers, query, err := opts.ToObjectCreateParams()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
h[k] = v
@@ -218,7 +215,6 @@
if resp != nil {
r.Header = resp.Header
}
- return r
}
// CopyOptsBuilder allows extensions to add additional parameters to the
@@ -250,13 +246,12 @@
}
// Copy is a function that copies one object to another.
-func Copy(c *gophercloud.ServiceClient, containerName, objectName string, opts CopyOptsBuilder) CopyResult {
- var r CopyResult
+func Copy(c *gophercloud.ServiceClient, containerName, objectName string, opts CopyOptsBuilder) (r CopyResult) {
h := make(map[string]string)
headers, err := opts.ToObjectCopyMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
@@ -272,7 +267,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// DeleteOptsBuilder allows extensions to add additional parameters to the
@@ -293,14 +287,13 @@
}
// Delete is a function that deletes an object.
-func Delete(c *gophercloud.ServiceClient, containerName, objectName string, opts DeleteOptsBuilder) DeleteResult {
- var r DeleteResult
+func Delete(c *gophercloud.ServiceClient, containerName, objectName string, opts DeleteOptsBuilder) (r DeleteResult) {
url := deleteURL(c, containerName, objectName)
if opts != nil {
query, err := opts.ToObjectDeleteQuery()
if err != nil {
r.Err = err
- return r
+ return
}
url += query
}
@@ -309,7 +302,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// GetOptsBuilder allows extensions to add additional parameters to the
@@ -332,14 +324,13 @@
// Get is a function that retrieves the metadata of an object. To extract just the custom
// metadata, pass the GetResult response to the ExtractMetadata function.
-func Get(c *gophercloud.ServiceClient, containerName, objectName string, opts GetOptsBuilder) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, containerName, objectName string, opts GetOptsBuilder) (r GetResult) {
url := getURL(c, containerName, objectName)
if opts != nil {
query, err := opts.ToObjectGetQuery()
if err != nil {
r.Err = err
- return r
+ return
}
url += query
}
@@ -350,7 +341,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// UpdateOptsBuilder allows extensions to add additional parameters to the
@@ -384,14 +374,13 @@
}
// Update is a function that creates, updates, or deletes an object's metadata.
-func Update(c *gophercloud.ServiceClient, containerName, objectName string, opts UpdateOptsBuilder) UpdateResult {
- var r UpdateResult
+func Update(c *gophercloud.ServiceClient, containerName, objectName string, opts UpdateOptsBuilder) (r UpdateResult) {
h := c.AuthenticatedHeaders()
if opts != nil {
headers, err := opts.ToObjectUpdateMap()
if err != nil {
r.Err = err
- return r
+ return
}
for k, v := range headers {
@@ -406,7 +395,6 @@
r.Header = resp.Header
}
r.Err = err
- return r
}
// HTTPMethod represents an HTTP method string (e.g. "GET").