Skip to content

Commit

Permalink
pkg/boot/bls: Replace cutConf function with strings.TrimSuffix()
Browse files Browse the repository at this point in the history
Signed-off-by: Shelly Chang <[email protected]>
  • Loading branch information
ShellyChang110 authored and rminnich committed Jun 12, 2023
1 parent a87349c commit 6daa073
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions pkg/boot/bls/bls.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ const (
blsDefaultRank = 1
)

func cutConf(s string) string {
if strings.HasSuffix(s, ".conf") {
return s[:len(s)-6]
}
return s
}

// ScanBLSEntries scans the filesystem root for valid BLS entries.
// This function skips over invalid or unreadable entries in an effort
// to return everything that is bootable. map variables is the parsed result
Expand Down Expand Up @@ -72,7 +65,7 @@ func ScanBLSEntries(log ulog.Logger, fsRoot string, variables map[string]string)
// in the spec (but not mandated, surprisingly).
imgs := make(map[string]boot.OSImage)
for _, f := range files {
identifier := cutConf(filepath.Base(f))
identifier := strings.TrimSuffix(filepath.Base(f), ".conf")

img, err := parseBLSEntry(f, fsRoot, variables)
if err != nil {
Expand Down

0 comments on commit 6daa073

Please sign in to comment.