Skip to content

Add Arch() to os.Release #305

Merged
kke merged 1 commit intomainfrom
os-release-arch
Mar 26, 2026
Merged

Add Arch() to os.Release #305
kke merged 1 commit intomainfrom
os-release-arch

Conversation

@kke
Copy link
Copy Markdown
Contributor

@kke kke commented Mar 26, 2026

Each OS resolver now runs uname -m (Linux/Darwin) or $env:PROCESSOR_ARCHITECTURE (Windows) alongside existing OS detection commands and stores the raw value in Release.arch. Arch() normalizes it to a GOARCH string (amd64, arm64, arm, 386), returning sentinel errors ErrArchNotDetected or ErrUnrecognizedArch on failure.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CPU architecture detection to remote OS release resolution, storing the raw architecture string on os.Release and exposing a new Arch() helper to normalize that value to a GOARCH string for downstream use.

Changes:

  • Capture raw architecture during OS resolution (uname -m on Linux/Darwin; $env:PROCESSOR_ARCHITECTURE on Windows).
  • Add (*Release).Arch() plus sentinel errors for “not detected” and “unrecognized” architecture values.
  • Extend Linux resolver test coverage to validate Arch() normalization for x86_64 -> amd64.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
os/release.go Adds arch normalization, Arch() API, sentinel errors; also changes String() receiver.
os/linux.go Executes uname -m and stores result in Release.arch.
os/darwin.go Executes uname -m and stores result in Release.arch.
os/windows.go Reads $env:PROCESSOR_ARCHITECTURE and stores result in Release.arch.
os/linux_test.go Mocks uname -m and asserts Arch() returns amd64.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kke kke requested a review from Copilot March 26, 2026 14:42
@kke kke changed the title Add Arch() to os.Release for normalized GOARCH detection Add Arch() to os.Release Mar 26, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Each OS resolver now runs uname -m (Linux/Darwin) or
$env:PROCESSOR_ARCHITECTURE (Windows) alongside existing OS detection
commands and stores the raw value in Release.arch. Arch() normalizes
it to a GOARCH string (amd64, arm64, arm, 386), returning sentinel
errors ErrArchNotDetected or ErrUnrecognizedArch on failure.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kke kke marked this pull request as ready for review March 26, 2026 15:22
@kke kke merged commit 4aecf22 into main Mar 26, 2026
15 checks passed
@kke kke deleted the os-release-arch branch March 26, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants