Closed Fedosin closed 4 years ago
@Fedosin Thanks for submitting this.
As well, thank you for including tests! I hate to nit-pick on this, but would it be possible to quickly reformat the fixtures to be:
package testing
import (
"testing"
"github.com/gophercloud/utils/openstack/clientconfig"
th "github.com/gophercloud/gophercloud/testhelper"
yaml "gopkg.in/yaml.v2"
)
var VirginiaExpected = `clouds:
virginia:
auth:
auth_url: https://va.example.com:5000/v3
application_credential_id: app-cred-id
application_credential_secret: secret
auth_type: v3applicationcredential
region_name: VA
verify: true
`
var HawaiiExpected = `clouds:
hawaii:
auth:
auth_url: https://hi.example.com:5000/v3
username: jdoe
password: password
project_name: Some Project
domain_name: default
region_name: HNL
verify: true
`
func TestMarshallCloudToYaml(t *testing.T) {
...
@jtopjian done!
Currently when we try to marshal Clouds, it produces a lot of fields with empty strings, which is not correct.
This patch adds "omitempty" tag to all Cloud fields to allow correct marshalling of the structure.