Skip to content

Commit

Permalink
libhvee_windows: Use uint64 as arg for disk resize function
Browse files Browse the repository at this point in the history
It will reduce following error for golint ci.
```
pkg/drivers/libhvee/libhvee_windows.go:92:31: G115: integer overflow conversion uint64 -> int64 (gosec)
		if err := d.resizeDisk(int64(update.DiskCapacity)); err != nil {
		                            ^
pkg/drivers/libhvee/libhvee_windows.go:196:27: G115: integer overflow conversion uint64 -> int64 (gosec)
	return d.resizeDisk(int64(d.DiskCapacity))
	                         ^
pkg/drivers/libhvee/libhvee_windows.go:288:26: G115: integer overflow conversion int64 -> uint64 (gosec)
	newSize := strongunits.B(newSizeBytes)
```
  • Loading branch information
praveenkumar committed Oct 8, 2024
1 parent 42d1adb commit 22533ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/drivers/libhvee/libhvee_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (d *Driver) UpdateConfigRaw(rawConfig []byte) error {
}
}
if update.DiskCapacity != d.DiskCapacity {
if err := d.resizeDisk(int64(update.DiskCapacity)); err != nil {
if err := d.resizeDisk(update.DiskCapacity); err != nil {
log.Warnf("Machine: libhvee -> Failed to set disk size to %d", update.DiskCapacity)
return err
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func (d *Driver) Create() error {

log.Debugf("Machine: libhvee -> creating: done")

return d.resizeDisk(int64(d.DiskCapacity))
return d.resizeDisk(d.DiskCapacity)

}

Expand Down Expand Up @@ -283,7 +283,7 @@ func (d *Driver) getDiskPath() string {
return d.ResolveStorePath(fmt.Sprintf("%s.%s", d.MachineName, d.ImageFormat))
}

func (d *Driver) resizeDisk(newSizeBytes int64) error {
func (d *Driver) resizeDisk(newSizeBytes uint64) error {

newSize := strongunits.B(newSizeBytes)

Expand Down

0 comments on commit 22533ff

Please sign in to comment.