Skip to content

Commit eba698b

Browse files
committed
fix: revive var-naming
Rename variables based on idiomatic principles, per `revive` and `golangci-lint`. Signed-off-by: Ryan Johnson <[email protected]>
1 parent 0180415 commit eba698b

24 files changed

+122
-124
lines changed

vsphere/data_source_vsphere_dynamic.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ func dataSourceVSphereDynamicRead(d *schema.ResourceData, meta interface{}) erro
4545
if err != nil {
4646
return err
4747
}
48-
tagIds := d.Get("filter").(*schema.Set).List()
49-
matches, err := filterObjectsByTag(tm, tagIds)
48+
tagIDs := d.Get("filter").(*schema.Set).List()
49+
matches, err := filterObjectsByTag(tm, tagIDs)
5050
if err != nil {
5151
return err
5252
}
@@ -94,11 +94,11 @@ func filterObjectsByName(d *schema.ResourceData, meta interface{}, matches []tag
9494

9595
func filterObjectsByTag(tm *tags.Manager, t []interface{}) ([]tags.AttachedObjects, error) {
9696
log.Printf("[DEBUG] dataSourceDynamic: Filtering objects by tags.")
97-
var tagIds []string
97+
var tagIDs []string
9898
for _, ti := range t {
99-
tagIds = append(tagIds, ti.(string))
99+
tagIDs = append(tagIDs, ti.(string))
100100
}
101-
matches, err := tm.GetAttachedObjectsOnTags(context.TODO(), tagIds)
101+
matches, err := tm.GetAttachedObjectsOnTags(context.TODO(), tagIDs)
102102
if err != nil {
103103
return nil, err
104104
}

vsphere/data_source_vsphere_dynamic_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestAccDataSourceVSphereDynamic_regexAndTag(t *testing.T) {
2424
{
2525
Config: testAccDataSourceVSphereConfigRegexAndTag(),
2626
Check: resource.ComposeTestCheckFunc(
27-
testMatchDatacenterIds("vsphere_datacenter.dc2", "data.vsphere_dynamic.dyn1"),
27+
testMatchDatacenterIDs("vsphere_datacenter.dc2", "data.vsphere_dynamic.dyn1"),
2828
),
2929
},
3030
{
@@ -45,7 +45,7 @@ func TestAccDataSourceVSphereDynamic_multiTag(t *testing.T) {
4545
{
4646
Config: testAccDataSourceVSphereConfigMultiTag(),
4747
Check: resource.ComposeTestCheckFunc(
48-
testMatchDatacenterIds("vsphere_datacenter.dc1", "data.vsphere_dynamic.dyn2"),
48+
testMatchDatacenterIDs("vsphere_datacenter.dc1", "data.vsphere_dynamic.dyn2"),
4949
),
5050
},
5151
{
@@ -82,7 +82,7 @@ func TestAccDataSourceVSphereDynamic_typeFilter(t *testing.T) {
8282
{
8383
Config: testAccDataSourceVSphereConfigType(),
8484
Check: resource.ComposeTestCheckFunc(
85-
testMatchDatacenterIds("vsphere_datacenter.dc1", "data.vsphere_dynamic.dyn4"),
85+
testMatchDatacenterIDs("vsphere_datacenter.dc1", "data.vsphere_dynamic.dyn4"),
8686
),
8787
},
8888
{
@@ -92,7 +92,7 @@ func TestAccDataSourceVSphereDynamic_typeFilter(t *testing.T) {
9292
})
9393
}
9494

95-
func testMatchDatacenterIds(a, b string) resource.TestCheckFunc {
95+
func testMatchDatacenterIDs(a, b string) resource.TestCheckFunc {
9696
return func(s *terraform.State) error {
9797
ida := s.RootModule().Resources[a].Primary.Attributes["moid"]
9898
idb := s.RootModule().Resources[b].Primary.ID

vsphere/data_source_vsphere_role_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
const NoAccessRoleDescription = "No access"
1414
const NoAccessRoleName = "NoAccess"
15-
const NoAccessRoleId = "-5"
15+
const NoAccessRoleID = "-5"
1616

1717
func TestAccDataSourceVSphereRole_basic(t *testing.T) {
1818
resource.Test(t, resource.TestCase{
@@ -65,7 +65,7 @@ func TestAccDataSourceVSphereRole_systemRoleData(t *testing.T) {
6565
Config: testAccDataSourceVSphereRoleSystemRoleConfig(),
6666
Check: resource.ComposeTestCheckFunc(
6767
resource.TestCheckResourceAttr("data.vsphere_role.role1", "name", NoAccessRoleName),
68-
resource.TestCheckResourceAttr("data.vsphere_role.role1", "id", NoAccessRoleId),
68+
resource.TestCheckResourceAttr("data.vsphere_role.role1", "id", NoAccessRoleID),
6969
resource.TestCheckResourceAttr("data.vsphere_role.role1", "role_privileges.#", "0")),
7070
},
7171
},

vsphere/internal/helper/guestoscustomizations/customizations_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func FlattenGuestOsCustomizationSpec(d *schema.ResourceData, specItem *types.Cus
379379
return nil
380380
}
381381

382-
func IsSpecOsApplicableToVmOs(vmOsFamily types.VirtualMachineGuestOsFamily, specType string) bool {
382+
func IsSpecOsApplicableToVMOs(vmOsFamily types.VirtualMachineGuestOsFamily, specType string) bool {
383383
if specType == GuestOsCustomizationTypeWindows && vmOsFamily == types.VirtualMachineGuestOsFamilyWindowsGuest {
384384
return true
385385
}

vsphere/internal/helper/ovfdeploy/ovf_helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ func DeployOvfAndGetResult(client *govmomi.Client, ovfCreateImportSpecResult *ty
126126
return nfcLease.Complete(context.Background())
127127
}
128128

129-
func upload(ctx context.Context, client *govmomi.Client, item types.OvfFileItem, f io.Reader, rawUrl string, size int64, totalBytesRead *int64) error {
130-
u, err := client.ParseURL(rawUrl)
129+
func upload(ctx context.Context, client *govmomi.Client, item types.OvfFileItem, f io.Reader, rawURL string, size int64, totalBytesRead *int64) error {
130+
u, err := client.ParseURL(rawURL)
131131
if err != nil {
132132
return err
133133
}

vsphere/internal/virtualdevice/virtual_machine_device_subresource.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,11 +1078,11 @@ func (c *pciApplyConfig) modifyVirtualPciDevices(devList *schema.Set, op types.V
10781078
// virtual machine.
10791079
func PciPassthroughApplyOperation(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) (object.VirtualDeviceList, []types.BaseVirtualDeviceConfigSpec, error) {
10801080
old, newValue := d.GetChange("pci_device_id")
1081-
oldDevIds := old.(*schema.Set)
1082-
newDevIds := newValue.(*schema.Set)
1081+
oldDevIDs := old.(*schema.Set)
1082+
newDevIDs := newValue.(*schema.Set)
10831083

1084-
delDevs := oldDevIds.Difference(newDevIds)
1085-
addDevs := newDevIds.Difference(oldDevIds)
1084+
delDevs := oldDevIDs.Difference(newDevIDs)
1085+
addDevs := newDevIDs.Difference(oldDevIDs)
10861086
applyConfig := &pciApplyConfig{
10871087
Client: c,
10881088
ResourceData: d,
@@ -1118,11 +1118,11 @@ func PciPassthroughApplyOperation(d *schema.ResourceData, c *govmomi.Client, l o
11181118
// operations. It also sets the state in advance of the post-create read.
11191119
func PciPassthroughPostCloneOperation(d *schema.ResourceData, c *govmomi.Client, l object.VirtualDeviceList) (object.VirtualDeviceList, []types.BaseVirtualDeviceConfigSpec, error) {
11201120
old, newValue := d.GetChange("pci_device_id")
1121-
oldDevIds := old.(*schema.Set)
1122-
newDevIds := newValue.(*schema.Set)
1121+
oldDevIDs := old.(*schema.Set)
1122+
newDevIDs := newValue.(*schema.Set)
11231123

1124-
delDevs := oldDevIds.Difference(newDevIds)
1125-
addDevs := newDevIds.Difference(oldDevIds)
1124+
delDevs := oldDevIDs.Difference(newDevIDs)
1125+
addDevs := newDevIDs.Difference(oldDevIDs)
11261126
applyConfig := &pciApplyConfig{
11271127
Client: c,
11281128
ResourceData: d,

vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -976,10 +976,10 @@ func DiskCloneRelocateOperation(resourceData *schema.ResourceData, client *govmo
976976
Sets the value of the VM datastore
977977
*/
978978
func addDiskDatastore(r *DiskSubresource, d *schema.ResourceData) *DiskSubresource {
979-
diskDsId := r.Get("datastore_id")
980-
dataDsId := d.Get("datastore_id")
981-
if (diskDsId == "" || diskDsId == diskDatastoreComputedName) && dataDsId != "" {
982-
r.Set("datastore_id", dataDsId)
979+
diskDsID := r.Get("datastore_id")
980+
dataDsID := d.Get("datastore_id")
981+
if (diskDsID == "" || diskDsID == diskDatastoreComputedName) && dataDsID != "" {
982+
r.Set("datastore_id", dataDsID)
983983
}
984984

985985
return r
@@ -999,8 +999,8 @@ func shouldAddRelocateSpec(d *schema.ResourceData, disk *types.VirtualDisk, sche
999999

10001000
// If the VM is cloned to a datastore cluster and no datastore is specified for the disk
10011001
// it should not be added to the relocate spec
1002-
diskDataStoreId, _ := dataProps["datastore_id"].(string)
1003-
diskDsIsEmpty := diskDataStoreId == "" || diskDataStoreId == diskDatastoreComputedName
1002+
diskDataStoreID, _ := dataProps["datastore_id"].(string)
1003+
diskDsIsEmpty := diskDataStoreID == "" || diskDataStoreID == diskDatastoreComputedName
10041004
if d.Get("datastore_id") == "" && d.Get("datastore_cluster_id") != "" && diskDsIsEmpty {
10051005
return false
10061006
}
@@ -1058,8 +1058,8 @@ func virtualDiskToSchemaPropsMap(disk *types.VirtualDisk) map[string]interface{}
10581058
func diskDataToSchemaProps(d *schema.ResourceData, deviceIndex int) map[string]interface{} {
10591059
m := make(map[string]interface{})
10601060
datastoreKey := fmt.Sprintf("disk.%d.datastore_id", deviceIndex)
1061-
if datastoreId, ok := d.GetOk(datastoreKey); ok {
1062-
m["datastore_id"] = datastoreId
1061+
if datastoreID, ok := d.GetOk(datastoreKey); ok {
1062+
m["datastore_id"] = datastoreID
10631063
}
10641064

10651065
diskModeKey := fmt.Sprintf("disk.%d.disk_mode", deviceIndex)

vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -833,25 +833,25 @@ func (r *NetworkInterfaceSubresource) Create(l object.VirtualDeviceList) ([]type
833833

834834
// Minimum Supported Version: 6.0.0
835835
if (version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) && r.Get("adapter_type") != networkInterfaceSubresourceTypeSriov) {
836-
bandwidth_limit := structure.Int64Ptr(-1)
837-
bandwidth_reservation := structure.Int64Ptr(0)
838-
bandwidth_share_level := types.SharesLevelNormal
836+
bandwidthLimit := structure.Int64Ptr(-1)
837+
bandwidthReservation := structure.Int64Ptr(0)
838+
bandwidthShareLevel := types.SharesLevelNormal
839839
if r.Get("bandwidth_limit") != nil {
840-
bandwidth_limit = structure.Int64Ptr(int64(r.Get("bandwidth_limit").(int)))
840+
bandwidthLimit = structure.Int64Ptr(int64(r.Get("bandwidth_limit").(int)))
841841
}
842842
if r.Get("bandwidth_reservation") != nil {
843-
bandwidth_reservation = structure.Int64Ptr(int64(r.Get("bandwidth_reservation").(int)))
843+
bandwidthReservation = structure.Int64Ptr(int64(r.Get("bandwidth_reservation").(int)))
844844
}
845845
if r.Get("bandwidth_share_level") != nil {
846-
bandwidth_share_level = types.SharesLevel(r.Get("bandwidth_share_level").(string))
846+
bandwidthShareLevel = types.SharesLevel(r.Get("bandwidth_share_level").(string))
847847
}
848848

849849
alloc := &types.VirtualEthernetCardResourceAllocation{
850-
Limit: bandwidth_limit,
851-
Reservation: bandwidth_reservation,
850+
Limit: bandwidthLimit,
851+
Reservation: bandwidthReservation,
852852
Share: types.SharesInfo{
853853
Shares: int32(r.Get("bandwidth_share_count").(int)),
854-
Level: bandwidth_share_level,
854+
Level: bandwidthShareLevel,
855855
},
856856
}
857857
card.ResourceAllocation = alloc
@@ -1076,25 +1076,25 @@ func (r *NetworkInterfaceSubresource) Update(l object.VirtualDeviceList) ([]type
10761076

10771077
// Minimum Supported Version: 6.0.0
10781078
if (version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) && r.Get("adapter_type") != networkInterfaceSubresourceTypeSriov) {
1079-
bandwidth_limit := structure.Int64Ptr(-1)
1080-
bandwidth_reservation := structure.Int64Ptr(0)
1081-
bandwidth_share_level := types.SharesLevelNormal
1079+
bandwidthLimit := structure.Int64Ptr(-1)
1080+
bandwidthReservation := structure.Int64Ptr(0)
1081+
bandwidthShareLevel := types.SharesLevelNormal
10821082
if r.Get("bandwidth_limit") != nil {
1083-
bandwidth_limit = structure.Int64Ptr(int64(r.Get("bandwidth_limit").(int)))
1083+
bandwidthLimit = structure.Int64Ptr(int64(r.Get("bandwidth_limit").(int)))
10841084
}
10851085
if r.Get("bandwidth_reservation") != nil {
1086-
bandwidth_reservation = structure.Int64Ptr(int64(r.Get("bandwidth_reservation").(int)))
1086+
bandwidthReservation = structure.Int64Ptr(int64(r.Get("bandwidth_reservation").(int)))
10871087
}
10881088
if r.Get("bandwidth_share_level") != nil {
1089-
bandwidth_share_level = types.SharesLevel(r.Get("bandwidth_share_level").(string))
1089+
bandwidthShareLevel = types.SharesLevel(r.Get("bandwidth_share_level").(string))
10901090
}
10911091

10921092
alloc := &types.VirtualEthernetCardResourceAllocation{
1093-
Limit: bandwidth_limit,
1094-
Reservation: bandwidth_reservation,
1093+
Limit: bandwidthLimit,
1094+
Reservation: bandwidthReservation,
10951095
Share: types.SharesInfo{
10961096
Shares: int32(r.Get("bandwidth_share_count").(int)),
1097-
Level: bandwidth_share_level,
1097+
Level: bandwidthShareLevel,
10981098
},
10991099
}
11001100
card.ResourceAllocation = alloc
@@ -1127,19 +1127,19 @@ func (r *NetworkInterfaceSubresource) addPhysicalFunction(device types.BaseVirtu
11271127

11281128
// These seem to be the correct DeviceId, SystemId and VendorId settings if you
11291129
// investigate a manually created vSphere SRIOV network interface
1130-
physical_function_conf := &types.VirtualPCIPassthroughDeviceBackingInfo{
1130+
physicalFunctionConf := &types.VirtualPCIPassthroughDeviceBackingInfo{
11311131
Id: r.Get("physical_function").(string),
11321132
DeviceId: "0",
11331133
SystemId: "BYPASS",
11341134
VendorId: 0,
11351135
}
1136-
sriov_conf := &types.VirtualSriovEthernetCardSriovBackingInfo{
1137-
PhysicalFunctionBacking: physical_function_conf,
1136+
sriovConf := &types.VirtualSriovEthernetCardSriovBackingInfo{
1137+
PhysicalFunctionBacking: physicalFunctionConf,
11381138
}
11391139

11401140
device = &types.VirtualSriovEthernetCard{
11411141
VirtualEthernetCard: *d2.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard(),
1142-
SriovBacking: sriov_conf,
1142+
SriovBacking: sriovConf,
11431143
}
11441144

11451145
return device, nil

vsphere/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func Provider() *schema.Provider {
132132
"vsphere_tag_category": resourceVSphereTagCategory(),
133133
"vsphere_virtual_disk": resourceVSphereVirtualDisk(),
134134
"vsphere_virtual_machine": resourceVSphereVirtualMachine(),
135-
"vsphere_virtual_machine_class": resourceVsphereVmClass(),
135+
"vsphere_virtual_machine_class": resourceVsphereVMClass(),
136136
"vsphere_virtual_machine_snapshot": resourceVSphereVirtualMachineSnapshot(),
137137
"vsphere_nas_datastore": resourceVSphereNasDatastore(),
138138
"vsphere_storage_drs_vm_override": resourceVSphereStorageDrsVMOverride(),

vsphere/resource_vsphere_compute_cluster.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,25 @@ import (
1010
"sort"
1111
"strings"
1212

13-
"github.com/vmware/govmomi/vapi/cis/tasks"
14-
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
15-
"github.com/vmware/govmomi/vapi/rest"
16-
17-
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datastore"
18-
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/provider"
19-
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsanclient"
20-
21-
"github.com/vmware/govmomi/vim25/mo"
22-
23-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
24-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
2513
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource"
2614
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/customattribute"
15+
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datastore"
2716
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/folder"
2817
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/hostsystem"
18+
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/provider"
2919
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/structure"
3020
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/viapi"
21+
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsanclient"
3122
"github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsansystem"
23+
24+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
25+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
3226
"github.com/vmware/govmomi"
3327
"github.com/vmware/govmomi/object"
28+
"github.com/vmware/govmomi/vapi/cis/tasks"
29+
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
30+
"github.com/vmware/govmomi/vapi/rest"
31+
"github.com/vmware/govmomi/vim25/mo"
3432
"github.com/vmware/govmomi/vim25/types"
3533
"github.com/vmware/govmomi/vsan"
3634
vsantypes "github.com/vmware/govmomi/vsan/types"
@@ -1167,12 +1165,12 @@ func resourceVSphereComputeClusterApplyHostImage(
11671165
}
11681166
}
11691167

1170-
draftId, err := m.CreateSoftwareDraft(d.Id())
1168+
draftID, err := m.CreateSoftwareDraft(d.Id())
11711169
if err != nil {
11721170
return err
11731171
}
11741172

1175-
if err := m.SetSoftwareDraftBaseImage(d.Id(), draftId, d.Get("host_image.0.esx_version").(string)); err != nil {
1173+
if err := m.SetSoftwareDraftBaseImage(d.Id(), draftID, d.Get("host_image.0.esx_version").(string)); err != nil {
11761174
return err
11771175
}
11781176

@@ -1184,19 +1182,19 @@ func resourceVSphereComputeClusterApplyHostImage(
11841182
spec.ComponentsToSet = getComponentsToAdd(oldComponentsMap, newComponentsMap)
11851183
componentsToRemove := getComponentsToRemove(oldComponentsMap, newComponentsMap)
11861184

1187-
if err = m.UpdateSoftwareDraftComponents(d.Id(), draftId, spec); err != nil {
1185+
if err = m.UpdateSoftwareDraftComponents(d.Id(), draftID, spec); err != nil {
11881186
return err
11891187
}
11901188

11911189
if len(componentsToRemove) > 0 {
11921190
for _, componentId := range componentsToRemove {
1193-
if err := m.RemoveSoftwareDraftComponents(d.Id(), draftId, componentId); err != nil {
1191+
if err := m.RemoveSoftwareDraftComponents(d.Id(), draftID, componentId); err != nil {
11941192
return err
11951193
}
11961194
}
11971195
}
11981196

1199-
taskId, err := m.CommitSoftwareDraft(d.Id(), draftId, clusters.SettingsClustersSoftwareDraftsCommitSpec{})
1197+
taskId, err := m.CommitSoftwareDraft(d.Id(), draftID, clusters.SettingsClustersSoftwareDraftsCommitSpec{})
12001198
if err != nil {
12011199
return err
12021200
}

vsphere/resource_vsphere_compute_cluster_vm_group.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func resourceVSphereComputeClusterVMGroupUpdate(d *schema.ResourceData, meta int
169169
return err
170170
}
171171

172-
// Convert existing and new virtual machines to string slices for diffVmGroup.
172+
// Convert existing and new virtual machines to string slices for diffVMGroup.
173173
existingVMs := make([]string, len(existingGroup.Vm))
174174
for i, vm := range existingGroup.Vm {
175175
existingVMs[i] = vm.Value
@@ -180,8 +180,8 @@ func resourceVSphereComputeClusterVMGroupUpdate(d *schema.ResourceData, meta int
180180
newVMs[i] = vm.Value
181181
}
182182

183-
// Use diffVmGroup to find added and removed virtual machines from virtual machine group.
184-
addedVMs, removedVMs := diffVmGroup(existingVMs, newVMs)
183+
// Use diffVMGroup to find added and removed virtual machines from virtual machine group.
184+
addedVMs, removedVMs := diffVMGroup(existingVMs, newVMs)
185185

186186
// Convert addedVMs and removedVMs back to ManagedObjectReference slices.
187187
addedVMRefs := make([]types.ManagedObjectReference, len(addedVMs))
@@ -475,7 +475,7 @@ func resourceVSphereComputeClusterVMGroupClient(meta interface{}) (*govmomi.Clie
475475
return client, nil
476476
}
477477

478-
func diffVmGroup(oldVMs, newVMs []string) ([]string, []string) {
478+
func diffVMGroup(oldVMs, newVMs []string) ([]string, []string) {
479479
oldVMMap := make(map[string]bool)
480480
for _, vm := range oldVMs {
481481
oldVMMap[vm] = true

vsphere/resource_vsphere_distributed_virtual_switch_pvlan_mapping_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ func testAccResourceVSphereDistributedVirtualSwitchPvlanMappingExists(expected b
8080
return fmt.Errorf("could not find pvlan mapping resource: %s", err)
8181
}
8282

83-
primary_vlan_id, err := strconv.Atoi(mappingToSearchFor.resourceAttributes["primary_vlan_id"])
83+
primaryVlanID, err := strconv.Atoi(mappingToSearchFor.resourceAttributes["primaryVlanID"])
8484
if err != nil {
8585
return err
8686
}
87-
secondary_vlan_id, err := strconv.Atoi(mappingToSearchFor.resourceAttributes["secondary_vlan_id"])
87+
secondaryVlanID, err := strconv.Atoi(mappingToSearchFor.resourceAttributes["secondaryVlanID"])
8888
if err != nil {
8989
return err
9090
}
91-
pvlan_type := mappingToSearchFor.resourceAttributes["pvlan_type"]
91+
pvlanType := mappingToSearchFor.resourceAttributes["pvlanType"]
9292

9393
for _, mapping := range props.Config.(*types.VMwareDVSConfigInfo).PvlanConfig {
94-
if mapping.PrimaryVlanId == int32(primary_vlan_id) && mapping.SecondaryVlanId == int32(secondary_vlan_id) && mapping.PvlanType == pvlan_type {
94+
if mapping.PrimaryVlanId == int32(primaryVlanID) && mapping.SecondaryVlanId == int32(secondaryVlanID) && mapping.PvlanType == pvlanType {
9595
if !expected {
9696
return fmt.Errorf("found PVLAN mapping when not expecting to")
9797
}

0 commit comments

Comments
 (0)