From 6aaccfd2bd25e2d4d4b1b880b318ac86188df9bd Mon Sep 17 00:00:00 2001 From: Kadin Sayani Date: Thu, 29 Aug 2024 10:39:21 -0600 Subject: [PATCH] lxc: fix go-vet linter Signed-off-by: Kadin Sayani --- lxc/info.go | 30 +++++++++++++++--------------- lxc/init.go | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lxc/info.go b/lxc/info.go index 6e6fde1a8ddc..02a84bfe4447 100644 --- a/lxc/info.go +++ b/lxc/info.go @@ -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) @@ -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) @@ -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) } @@ -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)) @@ -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) @@ -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) @@ -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) diff --git a/lxc/init.go b/lxc/init.go index 6014aa4118b2..9522c8b45179 100644 --- a/lxc/init.go +++ b/lxc/init.go @@ -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) }