Skip to content

Commit

Permalink
lxc: fix go-vet linter
Browse files Browse the repository at this point in the history
Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Aug 29, 2024
1 parent e5cabc7 commit 6aaccfd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions lxc/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c *cmdInfo) renderNIC(nic api.ResourcesNetworkCard, prefix string, initial
}

if port.Infiniband != nil {
fmt.Printf(prefix + " " + i18n.G("Infiniband:") + "\n")
fmt.Print(prefix + " " + i18n.G("Infiniband:") + "\n")

if port.Infiniband.IsSMName != "" {
fmt.Printf(prefix+" "+i18n.G("IsSM: %s (%s)")+"\n", port.Infiniband.IsSMName, port.Infiniband.IsSMDevice)
Expand Down Expand Up @@ -292,7 +292,7 @@ func (c *cmdInfo) renderDisk(disk api.ResourcesStorageDisk, prefix string, initi
fmt.Printf(prefix+i18n.G("Removable: %v")+"\n", disk.Removable)

if len(disk.Partitions) != 0 {
fmt.Printf(prefix + i18n.G("Partitions:") + "\n")
fmt.Print(prefix + i18n.G("Partitions:") + "\n")
for _, partition := range disk.Partitions {
fmt.Printf(prefix+" "+i18n.G("- Partition %d")+"\n", partition.Partition)
fmt.Printf(prefix+" "+i18n.G("ID: %s")+"\n", partition.ID)
Expand All @@ -314,17 +314,17 @@ func (c *cmdInfo) renderCPU(cpu api.ResourcesCPUSocket, prefix string) {
}

if cpu.Cache != nil {
fmt.Printf(prefix + i18n.G("Caches:") + "\n")
fmt.Print(prefix + i18n.G("Caches:") + "\n")
for _, cache := range cpu.Cache {
fmt.Printf(prefix+" "+i18n.G("- Level %d (type: %s): %s")+"\n", cache.Level, cache.Type, units.GetByteSizeStringIEC(int64(cache.Size), 0))
}
}

fmt.Printf(prefix + i18n.G("Cores:") + "\n")
fmt.Print(prefix + i18n.G("Cores:") + "\n")
for _, core := range cpu.Cores {
fmt.Printf(prefix+" - "+i18n.G("Core %d")+"\n", core.Core)
fmt.Printf(prefix+" "+i18n.G("Frequency: %vMhz")+"\n", core.Frequency)
fmt.Printf(prefix + " " + i18n.G("Threads:") + "\n")
fmt.Print(prefix + " " + i18n.G("Threads:") + "\n")
for _, thread := range core.Threads {
fmt.Printf(prefix+" - "+i18n.G("%d (id: %d, online: %v, NUMA node: %v)")+"\n", thread.Thread, thread.ID, thread.Online, thread.NUMANode)
}
Expand Down Expand Up @@ -372,20 +372,20 @@ func (c *cmdInfo) remoteInfo(d lxd.InstanceServer) error {
}

// Memory
fmt.Printf("\n" + i18n.G("Memory:") + "\n")
fmt.Print("\n" + i18n.G("Memory:") + "\n")
if resources.Memory.HugepagesTotal > 0 {
fmt.Printf(" " + i18n.G("Hugepages:"+"\n"))
fmt.Print(" " + i18n.G("Hugepages:"+"\n"))
fmt.Printf(" "+i18n.G("Free: %v")+"\n", units.GetByteSizeStringIEC(int64(resources.Memory.HugepagesTotal-resources.Memory.HugepagesUsed), 2))
fmt.Printf(" "+i18n.G("Used: %v")+"\n", units.GetByteSizeStringIEC(int64(resources.Memory.HugepagesUsed), 2))
fmt.Printf(" "+i18n.G("Total: %v")+"\n", units.GetByteSizeStringIEC(int64(resources.Memory.HugepagesTotal), 2))
}

if len(resources.Memory.Nodes) > 1 {
fmt.Printf(" " + i18n.G("NUMA nodes:"+"\n"))
fmt.Print(" " + i18n.G("NUMA nodes:"+"\n"))
for _, node := range resources.Memory.Nodes {
fmt.Printf(" "+i18n.G("Node %d:"+"\n"), node.NUMANode)
if node.HugepagesTotal > 0 {
fmt.Printf(" " + i18n.G("Hugepages:"+"\n"))
fmt.Print(" " + i18n.G("Hugepages:"+"\n"))
fmt.Printf(" "+i18n.G("Free: %v")+"\n", units.GetByteSizeStringIEC(int64(node.HugepagesTotal-node.HugepagesUsed), 2))
fmt.Printf(" "+i18n.G("Used: %v")+"\n", units.GetByteSizeStringIEC(int64(node.HugepagesUsed), 2))
fmt.Printf(" "+i18n.G("Total: %v")+"\n", units.GetByteSizeStringIEC(int64(node.HugepagesTotal), 2))
Expand All @@ -403,10 +403,10 @@ func (c *cmdInfo) remoteInfo(d lxd.InstanceServer) error {

// GPUs
if len(resources.GPU.Cards) == 1 {
fmt.Printf("\n" + i18n.G("GPU:") + "\n")
fmt.Print("\n" + i18n.G("GPU:") + "\n")
c.renderGPU(resources.GPU.Cards[0], " ", true)
} else if len(resources.GPU.Cards) > 1 {
fmt.Printf("\n" + i18n.G("GPUs:") + "\n")
fmt.Print("\n" + i18n.G("GPUs:") + "\n")
for id, gpu := range resources.GPU.Cards {
fmt.Printf(" "+i18n.G("Card %d:")+"\n", id)
c.renderGPU(gpu, " ", true)
Expand All @@ -415,10 +415,10 @@ func (c *cmdInfo) remoteInfo(d lxd.InstanceServer) error {

// Network interfaces
if len(resources.Network.Cards) == 1 {
fmt.Printf("\n" + i18n.G("NIC:") + "\n")
fmt.Print("\n" + i18n.G("NIC:") + "\n")
c.renderNIC(resources.Network.Cards[0], " ", true)
} else if len(resources.Network.Cards) > 1 {
fmt.Printf("\n" + i18n.G("NICs:") + "\n")
fmt.Print("\n" + i18n.G("NICs:") + "\n")
for id, nic := range resources.Network.Cards {
fmt.Printf(" "+i18n.G("Card %d:")+"\n", id)
c.renderNIC(nic, " ", true)
Expand All @@ -427,10 +427,10 @@ func (c *cmdInfo) remoteInfo(d lxd.InstanceServer) error {

// Storage
if len(resources.Storage.Disks) == 1 {
fmt.Printf("\n" + i18n.G("Disk:") + "\n")
fmt.Print("\n" + i18n.G("Disk:") + "\n")
c.renderDisk(resources.Storage.Disks[0], " ", true)
} else if len(resources.Storage.Disks) > 1 {
fmt.Printf("\n" + i18n.G("Disks:") + "\n")
fmt.Print("\n" + i18n.G("Disks:") + "\n")
for id, nic := range resources.Storage.Disks {
fmt.Printf(" "+i18n.G("Disk %d:")+"\n", id)
c.renderDisk(nic, " ", true)
Expand Down
4 changes: 2 additions & 2 deletions lxc/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ func (c *cmdInit) create(conf *config.Config, args []string, launch bool) (lxd.I
if !c.global.flagQuiet {
if d.HasExtension("instance_create_start") && launch {
if name == "" {
fmt.Printf(i18n.G("Launching the instance") + "\n")
fmt.Print(i18n.G("Launching the instance") + "\n")
} else {
fmt.Printf(i18n.G("Launching %s")+"\n", name)
}
} else {
if name == "" {
fmt.Printf(i18n.G("Creating the instance") + "\n")
fmt.Print(i18n.G("Creating the instance") + "\n")
} else {
fmt.Printf(i18n.G("Creating %s")+"\n", name)
}
Expand Down

0 comments on commit 6aaccfd

Please sign in to comment.