Skip to content

Commit 55ff08e

Browse files
srmungarCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent e5abaca commit 55ff08e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

internal/image/imageos/imageos.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,15 @@ func preImageOsInstall(installRoot string, template *config.ImageTemplate) error
611611
// Configure dpkg with the target architecture inside the chroot
612612
// This is needed for cross-architecture package installations
613613
// Set up binfmt_misc for cross-architecture binary execution if needed
614-
hostInfo, _ := system.GetHostOsInfo()
615-
hostArch := hostInfo["arch"]
614+
hostInfo, err := system.GetHostOsInfo()
615+
if err != nil {
616+
return fmt.Errorf("failed to determine host OS information: %w", err)
617+
}
618+
619+
hostArch, ok := hostInfo["arch"]
620+
if !ok || hostArch == "" {
621+
return fmt.Errorf("failed to determine host architecture from host OS information")
622+
}
616623

617624
// Normalize host architecture
618625
switch hostArch {

0 commit comments

Comments
 (0)