Skip to content

Commit

Permalink
config/supermicro.go: Correcting lint
Browse files Browse the repository at this point in the history
  • Loading branch information
splaspood committed Jul 18, 2024
1 parent fc87035 commit e7cce54
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions config/supermicro.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"bytes"
"encoding/xml"
"fmt"
"strings"

"golang.org/x/net/html/charset"
Expand Down Expand Up @@ -66,7 +67,7 @@ func NewSupermicroVendorConfigManager(configFormat string, vendorOptions map[str
func (cm *supermicroVendorConfig) FindOrCreateSetting(path []string, value string) *supermicroBiosCfgSetting {
biosCfg := cm.ConfigData.BiosCfg

var currentMenus *[]*supermicroBiosCfgMenu = &biosCfg.Menus
var currentMenus = &biosCfg.Menus

for i, part := range path {
if i == len(path)-1 {
Expand Down Expand Up @@ -98,8 +99,10 @@ func (cm *supermicroVendorConfig) FindOrCreateMenu(menus *[]*supermicroBiosCfgMe
return (*menus)[i]
}
}

newMenu := &supermicroBiosCfgMenu{Name: name}
*menus = append(*menus, newMenu)

return (*menus)[len(*menus)-1]
}

Expand Down Expand Up @@ -256,14 +259,16 @@ func (cm *supermicroVendorConfig) BootOrder(mode string) error {
case "LEGACY":
cm.Raw("Legacy Boot Option #1", "Hard Disk", []string{"Boot"})
cm.Raw("Legacy Boot Option #2", "Network", []string{"Boot"})

for i := 3; i < 8; i++ {
cm.Raw("Legacy Boot Option #"+string(i), "Disabled", []string{"Boot"})
cm.Raw("Legacy Boot Option #"+fmt.Sprint(i), "Disabled", []string{"Boot"})
}
case "UEFI":
cm.Raw("UEFI Boot Option #1", "UEFI Hard Disk", []string{"Boot"})
cm.Raw("UEFI Boot Option #2", "UEFI Network", []string{"Boot"})

for i := 3; i < 9; i++ {
cm.Raw("UEFI Boot Option #"+string(i), "Disabled", []string{"Boot"})
cm.Raw("UEFI Boot Option #"+fmt.Sprint(i), "Disabled", []string{"Boot"})
}
case "DUAL":
// TODO(jwb) Is this just both sets?
Expand All @@ -287,11 +292,10 @@ func (cm *supermicroVendorConfig) IntelSGX(mode string) error {
}

func (cm *supermicroVendorConfig) SecureBoot(enable bool) error {
if enable {
cm.Raw("Secure Boot", "Enabled", []string{"SMC Secure Boot Configuration"})
// cm.Raw("Secure Boot Mode", "Setup", []string{"SMC Secure Boot Configuration"})
} else {
if !enable {
cm.Raw("Secure Boot", "Disabled", []string{"SMC Secure Boot Configuration"})
} else {
cm.Raw("Secure Boot", "Enabled", []string{"SMC Secure Boot Configuration"})
}

return nil
Expand Down Expand Up @@ -323,6 +327,5 @@ func (cm *supermicroVendorConfig) SMT(enable bool) error {

func (cm *supermicroVendorConfig) SRIOV(enable bool) error {
// TODO(jwb) Need to figure out how we do this on platforms that support it...

return nil
}

0 comments on commit e7cce54

Please sign in to comment.