diff --git a/openstack/loadbalancer/v2/monitors/requests.go b/openstack/loadbalancer/v2/monitors/requests.go index 15a503badc..a679aca990 100644 --- a/openstack/loadbalancer/v2/monitors/requests.go +++ b/openstack/loadbalancer/v2/monitors/requests.go @@ -45,10 +45,7 @@ type ListOpts struct { // ToMonitorListQuery formats a ListOpts into a query string. func (opts ListOpts) ToMonitorListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // List returns a Pager which allows you to iterate over a collection of diff --git a/openstack/networking/v2/extensions/bgpvpns/requests.go b/openstack/networking/v2/extensions/bgpvpns/requests.go index 374b4daf5b..3707fe39c6 100644 --- a/openstack/networking/v2/extensions/bgpvpns/requests.go +++ b/openstack/networking/v2/extensions/bgpvpns/requests.go @@ -27,10 +27,7 @@ type ListOpts struct { // ToBGPVPNListQuery formats a ListOpts into a query string. func (opts ListOpts) ToBGPVPNListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // List the BGP VPNs @@ -152,10 +149,7 @@ type ListNetworkAssociationsOpts struct { // query string. func (opts ListNetworkAssociationsOpts) ToNetworkAssociationsListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // ListNetworkAssociations pages over the network associations of a specified @@ -241,10 +235,7 @@ type ListRouterAssociationsOpts struct { // query string. func (opts ListRouterAssociationsOpts) ToRouterAssociationsListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // ListRouterAssociations pages over the router associations of a specified @@ -363,10 +354,7 @@ type ListPortAssociationsOpts struct { // query string. func (opts ListPortAssociationsOpts) ToPortAssociationsListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // ListPortAssociations pages over the port associations of a specified diff --git a/openstack/networking/v2/extensions/fwaas_v2/rules/requests.go b/openstack/networking/v2/extensions/fwaas_v2/rules/requests.go index 521c9ef3ce..a29c429af1 100644 --- a/openstack/networking/v2/extensions/fwaas_v2/rules/requests.go +++ b/openstack/networking/v2/extensions/fwaas_v2/rules/requests.go @@ -78,10 +78,7 @@ type ListOpts struct { // ToRuleListQuery formats a ListOpts into a query string. func (opts ListOpts) ToRuleListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // List returns a Pager which allows you to iterate over a collection of diff --git a/openstack/networking/v2/extensions/layer3/routers/requests.go b/openstack/networking/v2/extensions/layer3/routers/requests.go index 5d31ec1138..1916358fd5 100644 --- a/openstack/networking/v2/extensions/layer3/routers/requests.go +++ b/openstack/networking/v2/extensions/layer3/routers/requests.go @@ -42,10 +42,7 @@ type ListOpts struct { // ToRouterListQuery formats a ListOpts into a query string. func (opts ListOpts) ToRouterListQuery() (string, error) { q, err := gophercloud.BuildQueryString(&opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // List returns a Pager which allows you to iterate over a collection of diff --git a/openstack/networking/v2/extensions/security/rules/requests.go b/openstack/networking/v2/extensions/security/rules/requests.go index 405cf549ca..cf4d719248 100644 --- a/openstack/networking/v2/extensions/security/rules/requests.go +++ b/openstack/networking/v2/extensions/security/rules/requests.go @@ -41,10 +41,7 @@ type ListOpts struct { // ToSecGroupListQuery formats a ListOpts into a query string. func (opts ListOpts) ToSecGroupListQuery() (string, error) { q, err := gophercloud.BuildQueryString(&opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // List returns a Pager which allows you to iterate over a collection of diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go index abc56f4773..521b7e92d3 100644 --- a/openstack/objectstorage/v1/objects/requests.go +++ b/openstack/objectstorage/v1/objects/requests.go @@ -323,10 +323,7 @@ func (opts CopyOpts) ToObjectCopyMap() (map[string]string, error) { // ToObjectCopyQuery formats a CopyOpts into a query. func (opts CopyOpts) ToObjectCopyQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // Copy is a function that copies one object to another. diff --git a/openstack/orchestration/v1/stacks/requests.go b/openstack/orchestration/v1/stacks/requests.go index c553351344..0e624ae42e 100644 --- a/openstack/orchestration/v1/stacks/requests.go +++ b/openstack/orchestration/v1/stacks/requests.go @@ -270,10 +270,7 @@ type ListOpts struct { // ToStackListQuery formats a ListOpts into a query string. func (opts ListOpts) ToStackListQuery() (string, error) { q, err := gophercloud.BuildQueryString(opts) - if err != nil { - return "", err - } - return q.String(), nil + return q.String(), err } // List returns a Pager which allows you to iterate over a collection of diff --git a/params.go b/params.go index 4a2ed6c942..6535d40714 100644 --- a/params.go +++ b/params.go @@ -438,7 +438,7 @@ func BuildQueryString(opts any) (*url.URL, error) { return &url.URL{RawQuery: params.Encode()}, nil } // Return an error if the underlying type of 'opts' isn't a struct. - return nil, fmt.Errorf("Options type is not a struct.") + return &url.URL{}, fmt.Errorf("Options type is not a struct.") } /*