Skip to content

Commit

Permalink
Use int64 instead of float64 in internal struct
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Oct 8, 2021
1 parent d4526a4 commit 9f4baee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/limactl/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func listAction(cmd *cobra.Command, args []string) error {
fmt.Sprintf("127.0.0.1:%d", inst.SSHLocalPort),
inst.Arch,
inst.CPUs,
units.BytesSize(inst.Memory),
units.BytesSize(inst.Disk),
units.BytesSize(float64(inst.Memory)),
units.BytesSize(float64(inst.Disk)),
inst.Dir,
)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/store/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type Instance struct {
Dir string `json:"dir"`
Arch limayaml.Arch `json:"arch"`
CPUs int `json:"cpus,omitempty"`
Memory float64 `json:"memory,omitempty"` // bytes
Disk float64 `json:"disk,omitempty"` // bytes
Memory int64 `json:"memory,omitempty"` // bytes
Disk int64 `json:"disk,omitempty"` // bytes

Networks []limayaml.Network `json:"network,omitempty"`
SSHLocalPort int `json:"sshLocalPort,omitempty"`
Expand Down Expand Up @@ -76,11 +76,11 @@ func Inspect(instName string) (*Instance, error) {
inst.CPUs = y.CPUs
memory, err := units.RAMInBytes(y.Memory)
if err == nil {
inst.Memory = float64(memory)
inst.Memory = memory
}
disk, err := units.RAMInBytes(y.Disk)
if err == nil {
inst.Disk = float64(disk)
inst.Disk = disk
}
inst.Networks = y.Networks
inst.SSHLocalPort = y.SSH.LocalPort // maybe 0
Expand Down

0 comments on commit 9f4baee

Please sign in to comment.