diff --git a/cmd/bash_completion/bash_completion.go b/cmd/bash_completion/bash_completion.go index 2a300c87..752884bc 100644 --- a/cmd/bash_completion/bash_completion.go +++ b/cmd/bash_completion/bash_completion.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "os" "github.com/hpcng/warewulf/internal/app/wwctl" + "os" ) func main() { diff --git a/cmd/man_page/man_page.go b/cmd/man_page/man_page.go index 45d42416..369026fa 100644 --- a/cmd/man_page/man_page.go +++ b/cmd/man_page/man_page.go @@ -2,13 +2,13 @@ package main import ( - "fmt" - "os" + "fmt" "github.com/hpcng/warewulf/internal/app/wwctl" + "os" ) func main() { - + if err := wwctl.GenManTree(os.Args[1]); err != nil { fmt.Println(err) return diff --git a/cmd/wwctl/main.go b/cmd/wwctl/main.go index e1e0f479..0676131e 100644 --- a/cmd/wwctl/main.go +++ b/cmd/wwctl/main.go @@ -9,4 +9,3 @@ func main() { root.Execute() } - diff --git a/internal/app/wwctl/container/exec/child/main.go b/internal/app/wwctl/container/exec/child/main.go index a7a16fde..05f1e439 100644 --- a/internal/app/wwctl/container/exec/child/main.go +++ b/internal/app/wwctl/container/exec/child/main.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package child diff --git a/internal/app/wwctl/container/exec/child/non-Linux.go b/internal/app/wwctl/container/exec/child/non-Linux.go index c8cc1725..96a4a9c7 100644 --- a/internal/app/wwctl/container/exec/child/non-Linux.go +++ b/internal/app/wwctl/container/exec/child/non-Linux.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package child diff --git a/internal/app/wwctl/container/exec/main.go b/internal/app/wwctl/container/exec/main.go index 1ad9ff03..2eb15a7b 100644 --- a/internal/app/wwctl/container/exec/main.go +++ b/internal/app/wwctl/container/exec/main.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package exec diff --git a/internal/app/wwctl/container/exec/non-linux.go b/internal/app/wwctl/container/exec/non-linux.go index a391ec15..5a869192 100644 --- a/internal/app/wwctl/container/exec/non-linux.go +++ b/internal/app/wwctl/container/exec/non-linux.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package exec diff --git a/internal/app/wwctl/node/add/main.go b/internal/app/wwctl/node/add/main.go index ab76b24a..5bda845a 100644 --- a/internal/app/wwctl/node/add/main.go +++ b/internal/app/wwctl/node/add/main.go @@ -24,15 +24,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } fmt.Printf("Added node: %s\n", a) - if SetClusterName != "" { - wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName) - n.ClusterName.Set(SetClusterName) + if SetClusterName != "" { + wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting cluster name to: %s\n", n.Id.Get(), SetClusterName) + n.ClusterName.Set(SetClusterName) err := nodeDB.NodeUpdate(n) if err != nil { - wwlog.Printf(wwlog.ERROR, "%s\n", err) - os.Exit(1) - } - } + wwlog.Printf(wwlog.ERROR, "%s\n", err) + os.Exit(1) + } + } if SetIpaddr != "" { if SetNetDev == "" { diff --git a/internal/app/wwctl/node/delete/root.go b/internal/app/wwctl/node/delete/root.go index 868ad862..c7aa4840 100644 --- a/internal/app/wwctl/node/delete/root.go +++ b/internal/app/wwctl/node/delete/root.go @@ -11,8 +11,8 @@ var ( RunE: CobraRunE, Aliases: []string{"rm", "del"}, } - SetYes bool - SetForce string + SetYes bool + SetForce string ) func init() { diff --git a/internal/app/wwctl/node/list/main.go b/internal/app/wwctl/node/list/main.go index a11063e8..996d656c 100644 --- a/internal/app/wwctl/node/list/main.go +++ b/internal/app/wwctl/node/list/main.go @@ -51,7 +51,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error { fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.IpmiInterface.Source(), node.IpmiInterface.Print()) - for name, netdev := range node.NetDevs { fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":HWADDR", netdev.Hwaddr.Source(), netdev.Hwaddr.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), name+":IPADDR", netdev.Ipaddr.Source(), netdev.Ipaddr.Print()) diff --git a/internal/app/wwctl/node/sensors/power.go b/internal/app/wwctl/node/sensors/power.go index 3f1dad88..96813079 100644 --- a/internal/app/wwctl/node/sensors/power.go +++ b/internal/app/wwctl/node/sensors/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } fullFlag := full diff --git a/internal/app/wwctl/overlay/list/main.go b/internal/app/wwctl/overlay/list/main.go index cc8e8847..76929b87 100644 --- a/internal/app/wwctl/overlay/list/main.go +++ b/internal/app/wwctl/overlay/list/main.go @@ -117,7 +117,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } var unconfigured bool - for overlay, _ := range set { + for overlay := range set { var overlayPath string if SystemOverlay == true { diff --git a/internal/app/wwctl/power/cycle/power.go b/internal/app/wwctl/power/cycle/power.go index b76aebc9..016e9a4f 100644 --- a/internal/app/wwctl/power/cycle/power.go +++ b/internal/app/wwctl/power/cycle/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } batchpool.Submit(func() { diff --git a/internal/app/wwctl/power/on/power.go b/internal/app/wwctl/power/on/power.go index 013d1dbc..a8c01f94 100644 --- a/internal/app/wwctl/power/on/power.go +++ b/internal/app/wwctl/power/on/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } batchpool.Submit(func() { diff --git a/internal/app/wwctl/power/status/power.go b/internal/app/wwctl/power/status/power.go index 98ecdf37..62e0698d 100644 --- a/internal/app/wwctl/power/status/power.go +++ b/internal/app/wwctl/power/status/power.go @@ -58,7 +58,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error { User: node.IpmiUserName.Get(), Password: node.IpmiPassword.Get(), Interface: ipmiInterface, - AuthType: "MD5", + AuthType: "MD5", } batchpool.Submit(func() { diff --git a/internal/app/wwctl/root.go b/internal/app/wwctl/root.go index c6d9023c..4ee65b88 100644 --- a/internal/app/wwctl/root.go +++ b/internal/app/wwctl/root.go @@ -1,7 +1,6 @@ package wwctl import ( - "io" "github.com/hpcng/warewulf/internal/app/wwctl/configure" "github.com/hpcng/warewulf/internal/app/wwctl/container" "github.com/hpcng/warewulf/internal/app/wwctl/kernel" @@ -14,6 +13,7 @@ import ( "github.com/hpcng/warewulf/internal/pkg/wwlog" "github.com/spf13/cobra" "github.com/spf13/cobra/doc" + "io" ) var ( @@ -64,13 +64,13 @@ func rootPersistentPreRunE(cmd *cobra.Command, args []string) error { // GenBashCompletionFile func GenBashCompletion(w io.Writer) error { - return rootCmd.GenBashCompletion(w) + return rootCmd.GenBashCompletion(w) } -func GenManTree(fileName string) error{ +func GenManTree(fileName string) error { header := &doc.GenManHeader{ - Title: "MINE", + Title: "MINE", Section: "1", } - return doc.GenManTree(rootCmd,header,fileName) + return doc.GenManTree(rootCmd, header, fileName) } diff --git a/internal/pkg/node/datastructure.go b/internal/pkg/node/datastructure.go index c20083e0..738277a9 100644 --- a/internal/pkg/node/datastructure.go +++ b/internal/pkg/node/datastructure.go @@ -29,7 +29,7 @@ type NodeConf struct { IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"` IpmiNetmask string `yaml:"ipmi netmask,omitempty"` IpmiGateway string `yaml:"ipmi gateway,omitempty"` - IpmiInterface string `yaml:"ipmi interface,omitempty"` + IpmiInterface string `yaml:"ipmi interface,omitempty"` RuntimeOverlay string `yaml:"runtime overlay,omitempty"` SystemOverlay string `yaml:"system overlay,omitempty"` Init string `yaml:"init,omitempty"` @@ -107,8 +107,8 @@ func init() { c, err := os.OpenFile(ConfigFile, os.O_RDWR|os.O_CREATE, 0644) if err != nil { wwlog.Printf(wwlog.ERROR, "Could not create new configuration file: %s\n", err) - // just return silently, as init is also called for bash_completion - return + // just return silently, as init is also called for bash_completion + return } fmt.Fprintf(c, "nodeprofiles:\n") diff --git a/internal/pkg/node/modifiers.go b/internal/pkg/node/modifiers.go index 1c6e42ac..0260d598 100644 --- a/internal/pkg/node/modifiers.go +++ b/internal/pkg/node/modifiers.go @@ -159,7 +159,7 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error { config.NodeProfiles[profileID].Profiles = profile.Profiles config.NodeProfiles[profileID].NetDevs = make(map[string]*NetDevs) - + config.NodeProfiles[profileID].Keys = make(map[string]string) for devname, netdev := range profile.NetDevs { diff --git a/internal/pkg/power/ipmitool.go b/internal/pkg/power/ipmitool.go index 4ef21882..5c70c11b 100644 --- a/internal/pkg/power/ipmitool.go +++ b/internal/pkg/power/ipmitool.go @@ -16,8 +16,8 @@ type IPMI struct { User string Password string AuthType string - Interface string - result IPMIResult + Interface string + result IPMIResult } func (ipmi *IPMI) Result() (string, error) { @@ -28,9 +28,9 @@ func (ipmi *IPMI) Command(ipmiArgs []string) ([]byte, error) { var args []string - if ipmi.Interface == "" { - ipmi.Interface = "lanplus" - } + if ipmi.Interface == "" { + ipmi.Interface = "lanplus" + } args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) args = append(args, ipmiArgs...) ipmiCmd := exec.Command("ipmitool", args...) @@ -41,9 +41,9 @@ func (ipmi *IPMI) InteractiveCommand(ipmiArgs []string) error { var args []string - if ipmi.Interface == "" { - ipmi.Interface = "lan" - } + if ipmi.Interface == "" { + ipmi.Interface = "lan" + } args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) args = append(args, ipmiArgs...) diff --git a/internal/pkg/warewulfconf/datastructure.go b/internal/pkg/warewulfconf/datastructure.go index c47a08d8..694101ad 100644 --- a/internal/pkg/warewulfconf/datastructure.go +++ b/internal/pkg/warewulfconf/datastructure.go @@ -1,7 +1,6 @@ package warewulfconf import ( - "github.com/hpcng/warewulf/internal/pkg/util" "github.com/hpcng/warewulf/internal/pkg/wwlog" ) @@ -51,7 +50,7 @@ func init() { //TODO: Check to make sure nodes.conf is found if util.IsFile(ConfigFile) == false { wwlog.Printf(wwlog.ERROR, "Configuration file not found: %s\n", ConfigFile) - // fail silently as this also called by bash_completion - return + // fail silently as this also called by bash_completion + return } }