Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #114 from xanzy/svh/b-float64
Browse files Browse the repository at this point in the history
Fix the type check to test for float64
  • Loading branch information
svanharmelen authored May 26, 2019
2 parents 725c0d9 + 00db80d commit 42f262b
Show file tree
Hide file tree
Showing 34 changed files with 156 additions and 155 deletions.
4 changes: 2 additions & 2 deletions cloudstack/AffinityGroupService.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,8 @@ func (r *UpdateVMAffinityGroupResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/AlertService.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ func (r *ArchiveAlertsResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -240,8 +240,8 @@ func (r *DeleteAlertsResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/ClusterService.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ func (r *DeleteClusterResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/DiskOfferingService.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ func (r *DeleteDiskOfferingResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/EventService.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ func (r *ArchiveEventsResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -240,8 +240,8 @@ func (r *DeleteEventsResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions cloudstack/GuestOSService.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ func (r *AddGuestOsMappingResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -470,8 +470,8 @@ func (r *GuestOsMapping) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -1167,8 +1167,8 @@ func (r *UpdateGuestOsMappingResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/HostService.go
Original file line number Diff line number Diff line change
Expand Up @@ -995,8 +995,8 @@ func (r *DeleteHostResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -2651,8 +2651,8 @@ func (r *UpdateHostPasswordResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
28 changes: 14 additions & 14 deletions cloudstack/ISOService.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ func (r *AttachIsoResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -403,8 +403,8 @@ func (r *CopyIsoResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -687,8 +687,8 @@ func (r *DetachIsoResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -1312,8 +1312,8 @@ func (r *Iso) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -1619,8 +1619,8 @@ func (r *RegisterIsoResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -1895,8 +1895,8 @@ func (r *UpdateIsoResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -2047,8 +2047,8 @@ func (r *UpdateIsoPermissionsResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/ImageStoreService.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ func (r *DeleteImageStoreResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -569,8 +569,8 @@ func (r *DeleteSecondaryStagingStoreResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/LoadBalancerService.go
Original file line number Diff line number Diff line change
Expand Up @@ -2080,8 +2080,8 @@ func (r *DeleteSslCertResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/NATService.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ func (r *EnableStaticNatResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/NetworkDeviceService.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ func (r *DeleteNetworkDeviceResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/NetworkOfferingService.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ func (r *DeleteNetworkOfferingResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/NetworkService.go
Original file line number Diff line number Diff line change
Expand Up @@ -3574,8 +3574,8 @@ func (r *ReleasePublicIpRangeResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/NicService.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ func (r *UpdateVmNicIpResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/PodService.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ func (r *DeletePodResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/PoolService.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ func (r *DeleteStoragePoolResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/RegionService.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ func (r *RemoveRegionResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions cloudstack/RoleService.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ func (r *DeleteRoleResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -346,8 +346,8 @@ func (r *DeleteRolePermissionResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -777,8 +777,8 @@ func (r *UpdateRolePermissionResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/SSHService.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ func (r *DeleteSSHKeyPairResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down Expand Up @@ -738,8 +738,8 @@ func (r *ResetSSHKeyForVirtualMachineResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/SecurityGroupService.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,8 @@ func (r *DeleteSecurityGroupResponse) UnmarshalJSON(b []byte) error {
}
}

if ostypeid, ok := m["ostypeid"].(int); ok {
m["ostypeid"] = strconv.Itoa(ostypeid)
if ostypeid, ok := m["ostypeid"].(float64); ok {
m["ostypeid"] = strconv.Itoa(int(ostypeid))
b, err = json.Marshal(m)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 42f262b

Please sign in to comment.